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
5
votes
2 answers

Node.js archiver Need syntax for excluding file types via glob

Using archiver.js (for Node.js), I need to exclude images from a recursive (multi-subdir) archive. Here is my code: const zip = archiver('zip', { zlib: { level: 9 } }); const output = await…
crashwap
  • 2,846
  • 3
  • 28
  • 62
3
votes
2 answers

Using archiver synchronously

I want to zip a folder and then I have to delete it in a Gulp task. I'm trying to use archiver in a synchronous way. I use the code like in the quick start guide in the npm page of archiver and it successfully create the zip file. But if i try also…
Glob Dug
  • 63
  • 6
3
votes
2 answers

Understanding streams in Node js

I am stuck on an issue where I need to create and download a zip of multiple files using NodeJs. Things I have tried and failed…
Raghu Chahar
  • 1,637
  • 2
  • 15
  • 33
3
votes
2 answers

Creating an in-memory .zip with archiver, and then sending this file to the client with koa on a node server

I (as a node server with Koa framework), need to take a JSON blob, turn it into a file with extension .json, then stick that in a zip archive, then send the archive as a file attachment in response to a request from the client. It seems the way to…
Caleb Jay
  • 2,159
  • 3
  • 32
  • 66
3
votes
1 answer

Stubbing library constructor calls with sinon

Up until now I have been using sinon to stub out function calls on objects included in my nodeJS code. For example I use the request library, and so in my tests I can stub out http calls like: var request = require('request'); //Somewhere further…
mindparse
  • 6,115
  • 27
  • 90
  • 191
2
votes
0 answers

archiver.js memory leak inside aws lambda

I'm using archiver to zip a few files in aws lambda. I see that when there is no more disk space to write, archiver still holds(or leaks) some data. I've been trying to do 'archive.close()' or 'archive.destroy()' but I keep getting…
Novice
  • 423
  • 1
  • 9
  • 17
2
votes
0 answers

Some files missing in zip archive

I am adding pdf files created by wkhtmptopdf to archiver.My purpose is to create a zip file of all the pdf's.I am posting the zip to s3 bucket. BUt in the bucket some files are missing in the zip file. Randomly out of all files some files are empty…
Ashish
  • 21
  • 1
2
votes
1 answer

How to create a ZIP file with Gulp that contains a lot of files?

I have a Gulp task where I add lots of files (more than 2700 in one case, but it can be several thousands in some others cases) in a ZIP file. The code is as follow: const fs = require('fs'); const archiver = require('archiver')('zip'); let zip =…
Romain Linsolas
  • 79,475
  • 49
  • 202
  • 273
1
vote
0 answers

Is it necessary to explicitly handle Node.js stream errors?

I'm using the archiver package in order to compress files and upload them via a stream. It's my first time using streams in Node.js, and in the documentation of archiver I have stumbled upon the following case: // good practice to catch this error…
pakut2
  • 500
  • 5
  • 21
1
vote
0 answers

file data stream has unexpected number of bytes

i used this package to create this function https://github.com/archiverjs/node-archiver import archiver from "archiver"; import fs from "fs"; async function compressDirToZip(inputDirPath:string, outputFilePath:string) { return new…
1
vote
1 answer

Can I get the Buffer from fs.createWriteStream()?

I have simple question - Can I get the Buffer from fs.createWriteStream()? In my case I use archiver NPM module which may create archives from Buffer. When this module end work with method archive.finalize() I may get result from…
HtmlMan
  • 45
  • 2
  • 9
1
vote
1 answer

How can I get a compressed file with archiver from a POST request?

I am building a NodeJS API with Express where when you make a POST, it generates a TAR file based on the body of the request. Problem: When the endpoint is a POST, I have access to the body of the request, and can seemingly make things with it.…
Cassidy
  • 3,328
  • 5
  • 39
  • 76
1
vote
0 answers

archive folder using archivejs library

Im trying to archive my folder that contains multiple files using archivejs library. As param, Im sending absolute path to the dir that contains my files. I would like to get zipped directory with files in the root of archive. Im creating zip…
Morten
  • 133
  • 4
  • 15
1
vote
4 answers

node.js - use archiver where output is buffer

I want to zip a few readeableStreams into a writableStream. the purpose is to do all in memory and not to create an actual zip file on disk. for that i'm using archiver let bufferOutput = Buffer.alloc(5000); let archive =…
Yoni Mayer
  • 1,212
  • 1
  • 14
  • 27
1
vote
1 answer

Set the destination path for glob match on archiverjs

I've been working with the archiverjs node module and it works great. I'd now like to use a glob match to determine which files to zip but I also want to set the destination path in the zip just like you can with the destPath option in the directory…
danseethaler
  • 881
  • 3
  • 11
  • 22
1
2 3