Questions tagged [archiverjs]

Archiver.js is a streaming interface for archive generation with JavaScript

About

Archiver ships with out of the box support for TAR and ZIP archives.

You can register additional formats with registerFormat.

Usages

var archiver = require('archiver');
var archive = archiver.create('zip', {}); // or archiver('zip', {});

Links

31 questions
0
votes
0 answers

How to zip single file using archive module

Im trying to zip a single file using archiver and I succeed but resulting zip file contains directory when unzipped and I want just the file. Here is a sample code: export async function zipFile(srcFilePath: string, zipFilePath: string) { const…
Hairi
  • 3,318
  • 2
  • 29
  • 68
0
votes
0 answers

Node zlib crazy memory consumption

I'm writing a script that appends JSON to a write stream using Node's archiver package. archiver then tarballs and gzips the write stream to a local file on disk. When I run this script however, the process' memory consumption can get up to 2GB!…
0
votes
1 answer

Trying to return a stream-buffer from a function

I am attempting to create a zip file containing a csv file and return it from a function as a buffer. The code I have is as follows: const archiver = require('archiver'); const streamBuffers = require("stream-buffers"); createZipFromCsv(csv) { …
0
votes
0 answers

Zip file generated by archiver got corrupted after copy with fs-extra

const fs = require("fs-extra"); const archiver = require("archiver"); const targetPath = __dirname + "/original.zip" const output = fs.createWriteStream(targetPath); const archive = archiver("zip", { zlib: { level: 9 }, // Sets the compression…
ddeark
  • 13
  • 3
0
votes
1 answer

node-archiver : Getting duplicate parent zip upon extracting

I have written below for zipping a directory : const archiver = require('archiver'); let createArchive = function(sourceDir, destDir) { const archive = archiver('zip'); const stream = fs.createWriteStream(destDir); return new…
Pawan Saxena
  • 521
  • 1
  • 4
  • 14
0
votes
1 answer

Node.js ArchiverJS library not writing to output filestream in AWS Lambda

I'm trying to zip the contents of a directory using node-archiver as suggested here. The function is running in AWS Lambda in the Node.js runtime environment. My function is as follows: function zipDirectory(source, outputTarget) { var archive =…
doberoi96
  • 413
  • 6
  • 22
0
votes
1 answer

How to control the order of zipped directories and files with "archiver.js"?

I am using archiver to zip two folders x and y: const out = ... // file write stream ... const zip = archiver('zip', {}); zip.on('error', (err: Error) => { throw err; }); zip.pipe(out); zip.directory('x', 'x'); zip.directory('y',…
Michael
  • 41,026
  • 70
  • 193
  • 341
0
votes
1 answer

Archiver combine/pipe with PassThrough(), append and finalize not a function - Nodejs Stream

So, I am downloading files with the help of Axios stream, zipping them with archiver then I want to upload the zip to s3 bucket. At first, I saved zip in local directory, everything worked fine like this. I used multipipe lib to combine…
Rahul
  • 108
  • 1
  • 8
0
votes
1 answer

Return zip file with node.js and express goes wrong

I cant manage to return a zip file in http response from nodejs with express. I'm using ArchiverJS and azure-function-express. I've been trying to figure this out for a day now and I cant get it to work.. My code: const createHandler =…
KENUBBE
  • 79
  • 1
  • 5
  • 12
0
votes
1 answer

using archiver module with downloadable online links

In a node application, I wish to download a zip file that contains pdfs downloaded from various urls on the internet (where if I type the url into a browser, it just directs me to download a pdf). I've been using the archiver module which is…
user11508332
  • 537
  • 1
  • 11
  • 28
0
votes
1 answer

Nodejs:How to grab all the files and archieve from subfolder

I am working on node.js app, I have list of folders to be archived in %APPDATA%/Archive/****/Licensing, **** is different versions.(v195,v196,v197 etc) From APPDATA I want to loop through all the version folders, and inside version folder I want to…
karansys
  • 2,449
  • 7
  • 40
  • 78
0
votes
1 answer

Compress word doc xml using archiver

I am trying to make a program in Node.js that would anonymize a given path for a word doc for a larger project. I have already unzipped the docx file and I have edited the document.xml file. All I need to do now is recompress it. I have looked into…
rbhog
  • 5
  • 1
  • 8
0
votes
0 answers

corrupt zip file while sending it to angular frontend

BACKEND CALL router.post('/exportZip', async function (req, res) { const source = path.join('./publics/', req.body.id); const out = './publics/' + req.body.id + '.zip'; const archive = archiver('zip', { zlib: { level: 0 } }); const stream =…
Lars Hendriks
  • 998
  • 5
  • 22
0
votes
1 answer

Can't download dynamically created ZIP archive

I'm trying to dynamically write an output from MySQL queries to archive. Here's my code: var async = require("async"); var mysql = require("mysql"); var express = require("express"); var archiver = require("archiver"); var app = express(); var…
Martin
  • 109
  • 2
  • 8
0
votes
1 answer

nodejs zip archiver issue with directory path in windows

I'm having an issue with using zip.directory in Windows. This is the file structure I'm trying to create: . ├── file1.txt ├── file2.txt └── file3.txt file2.txt and file3.txt are coming from a directory called dir. Here is the code I have on my…
inhwrbp
  • 569
  • 2
  • 4
  • 17