Questions tagged [node-archiver]

node based file and directory archiving with streaming interface, modular plugins can enable other archive formats to be written simply.

node based file and directory archiving with streaming interface, modular plugins can enable other archive formats to be written simply. For more details checkout on the github repository at https://github.com/archiverjs/node-archiver

42 questions
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
1 answer

Compress directory with Node.js but exclude some files

I'm trying to compress a directory with Archiver. I want to exclude certain directories or files such as node_modules recursively. For example, if I have a directory structure like this: folder-to-compress | node_modules | sub-folder |…
passionateLearner
  • 722
  • 1
  • 7
  • 19
1
vote
1 answer

I want to stream a ZIP archive via koa/node.js

i want to stream a ZIP file, but I can not get the stream to work in Koa. Here is what I have so far (simplified) import Stream from 'stream' import archiver from 'archiver' ... router.get('/zip', async ctx => { …
abnormi
  • 628
  • 1
  • 7
  • 15
1
vote
0 answers

NodeJS ZIP symlink and can't read them on Windows 10

I'm using Archiver in a NodeJS environment (running on linux) to create a ZIP with a structure like this: /root /documents /doc1.pdf /doc2.pdf /doc3.pdf /clientA /doc1.pdf < symlink to ../documents/doc1.pdf …
rekam
  • 1,061
  • 3
  • 13
  • 31
1
vote
1 answer

Archive without root folder in .zip [node-archiver]

I'm using node-archiver to archive folder "export" with photos inside. Everything works ok but inside archive I got folder 'offers' and photos are in this folder. I would like to have like a "flat" .zip, so when I'll unpack my .zip it unpack photos…
Gemmi
  • 1,252
  • 2
  • 13
  • 26
1
vote
0 answers

Failing to create zip file in node express: Error 21

I am trying to create zip file using express as follows. const archiver = require('archiver'); app.get('/path/download', async (req, res) => { const arch = archiver('zip'); arch.append('abc', { name: 'abc.txt'}); arch.append('cdf', {…
Pavan Kumar
  • 1,715
  • 1
  • 24
  • 48
1
vote
1 answer

API returning a zip file - Cannot set headers after they are sent to the client?

I have an API that creates a zip file using the archiver module in which I would like to pass back the zip as a respone and download it on the client side. However, when I try to pass the zip file back, I get the error Error [ERR_HTTP_HEADERS_SENT]:…
arcade16
  • 1,535
  • 4
  • 23
  • 45
1
vote
0 answers

node-archiver does not work in aws lambda

This code works well locally. However, it does not behave strangely in the aws lambda environment. No error occurs. However, it does not actually work. ( lambda ) The entry and progress events of the node-archiver are not raised. What is the…
김동오
  • 69
  • 1
  • 5
1
vote
0 answers

Npm Archiver to replace a file in zipped folder

Here is my api below. app.post('/downloadproject', function(req, res) { var projectName = 'web'; res.set('Content-Type', 'application/zip'); res.set('Content-Disposition', `attachment; filename=${projectName}.zip`); var zip =…
reddy
  • 67
  • 2
  • 7
1
vote
2 answers

Zip Create Process with Node Express of large ZIP packages

Goal We standing up a low volume site, where users (browser client) will select image files (284 KB per file) and then request a Node Express Server to bundle them into a ZIP for download to the web client. Issues & Design Constraints The…
Dr.YSG
  • 7,171
  • 22
  • 81
  • 139
1
vote
1 answer

Cant set headers after they are sent node.js

I am trying to combine multiple textfiles,convert them in a single zip file using zip archiver. exports.downloadFilesInZip = function(req, res, next) { var respObj = {}; var file_names = []; var projectId = 111; var file_ids = 11111; …
soldiershin
  • 1,612
  • 1
  • 18
  • 29
1
vote
1 answer

node-archiver destination folder

I'm using node-archiver to zip some files and in the zip file I find the archived files under the directory where was zipped from. So in the zip file, 'myfile.txt' is under this sort of directory: 'home/ubuntu/some_folder/another_folder/' I want to…
George I.
  • 560
  • 2
  • 7
  • 26
0
votes
2 answers

Nodejs Archiver ArchiverError: archive already finalizing

I want to zip folders excluding certain files/folders so I used the solution in this answer. The solution works for a single folder but throws error when there are multiple folders to be zipped. I need to make zips from each sub-folders of the…
0
votes
0 answers

How to use node-archiver in windows

Code from official documentation: // append files from a sub-directory, putting its contents at the root of archive archive.directory('subdir/', false); How do I need to change 'subdir/' in windows environment: archive.directory('F:/dir',…
wei
  • 1
0
votes
1 answer

dynamically zip generated pdf files node-archiver

I'm trying to create multiple PDF file using pdfkit, I have an array of users and I create a report for each one, the createTable()Function below returns a Buffer that I send to archiver to zip, once complete the zip file is sent for download to the…
JoelE
  • 169
  • 3
  • 12