node-archiver | a streaming interface for archive generation | Runtime Evironment library
kandi X-RAY | node-archiver Summary
kandi X-RAY | node-archiver Summary
a streaming interface for archive generation
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of node-archiver
node-archiver Key Features
node-archiver Examples and Code Snippets
~/my-function
├── index.js
└── node_modules
├── package.json
├── package-lock.json
├── test.txt //file to be sent zipped on s3
const archiver = require('archiver')
const fs = require('fs')
const AWS = require('aws-
Archiver archiver = ArchiverFactory.createArchiver(ArchiveFormat.TAR, CompressionType.GZIP);
Archiver archiver = ArchiverFactory.createArchiver(ArchiveFormat.TAR);
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: 1.7.0_45 (Oracle Corporation)
Built-By: jharting
Build-Jdk: 1.7.0_45
Implementation-Title: CDI APIs
Implementation-URL: http://cdi-spec.org
Implementation-Vendor: JBoss by
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven 3.5.2
Built-By: ...
Build-Jdk: 10.0.2
. . .
org.springframework.boot
spring-boot-maven-plugin
1.5.6
org.springframework.boot
spring-boot-maven-plugin
build-info
repackage
exec
${buildNumber}
Manifest-Version: 1.0
Implementation-Title:
var download = require('download-pdf')
var fs = require('fs');
var archiver = require('archiver');
var output = fs.createWriteStream('./example.zip');
var archive = archiver('zip', {
gzip: true,
zlib: { level: 9 } // Sets the compressi
var fs = require('fs');
var archiver = require('archiver');
var output = fs.createWriteStream('./example.zip');
var archive = archiver('zip', {
gzip: true,
zlib: { level: 9 } // Sets the compression level.
});
archive.on('error',
org.apache.maven.plugins
maven-shade-plugin
3.2.2
package
const path = require('path');
const archiver = require('archiver');
const fs = require('fs');
const FolderName = "fol";
const zipName = FolderName + ".zip";
const source = path.join(__dirname, "tmp", FolderName);
const out = path.join(__d
4.0.0
com.myname
runnable
1.0-SNAPSHOT
org.apache.maven.plugins
maven-jar-plugin
Community Discussions
Trending Discussions on node-archiver
QUESTION
I'm making a photo sharing web app. Users can select photos they want to download from a gallery view, and press a download button to download those selected photos into a ZIP file.
The problem is, I don't really know an efficient way to make a ZIP file from an array of files, especially with big sizes. Photos are about 2-3 MB in size, or even more for higher-res images.
I'm using Firebase functions, or specifically Google Cloud Functions. I already have a serverless function that does what I want, but it's super slow and takes up a lot of memory. It downloads all the selected photos into a temporary folder from Google Cloud Storage, uses node-archiver, and uploads the final ZIP file to Google Cloud Storage, where the link of that file to download is returned from the serverless function. 32 photos takes about 23 seconds for the function to complete, whereas 150 photos takes a whopping 97 seconds.
I tried using buffers instead of writing the files to a temporary directory, and it still had about the same times.
I got it to become a bit faster by deleting the files in the temporary folder as node-archiver appends it to the ZIP. This most likely eliminates some memory since the temporary folder for Google Cloud Functions are counted against memory too. 32 photos takes about 16 seconds, and 150 photos takes 81 seconds.
Is there any other efficient way to do this? I just thought about file streams as I was writing this question, but I'm not familiar with them.
...ANSWER
Answered 2021-Jan-12 at 12:02Photos (jpeg and png formats) are already stored in compressed format. ZIP compression is useless. You have to use ZIP only to group all the picture in the same file.
So, according to your ZIP lib, use the mode "store-only" or "no-compression" to speed up the process.
QUESTION
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:
...ANSWER
Answered 2020-Oct-02 at 21:09Alright, figured my mistake out.
archive.finalize()
returns a promise and the function was returning before the archiving was complete.- Calling
stream.close()
is unnecessary asarchive.finalize()
does that for you, so the stream was being closed regardless of whether the archiving was complete or not.
The correct code looks like this:
QUESTION
i’ve node.js app that I Need to zip all the current folder with command from and get the zip on the root
For that I want to use the archiver npm package but I don’t understand the following:
- where I put the current folder (since I want to zip all the application )
- where should I put the name of the zip (the zip that should be created when execute the command)
My app have the following structure
...ANSWER
Answered 2017-Oct-05 at 09:41In the github of node-archiver there is an example folder
where I put the current folder (since I want to zip all the application )
Example :
QUESTION
I am trying to generate large zip file (without compression, just storing the files) on the fly and stream it via restify
. The zip file can be bigger than 4 GiB in total and I ran to issue with ZIP64 format, that seems not to be supported properly on MacOS.
I tried using node-archiver
and yazl
, they are both able to generate the zip file, but I am not able to open it via native graphical utility in MacOS (e.g. just double-clicking on the file in Finder). The weirdest thing about this is, that the native unzip
command line utility works fine here, just the graphical Archive Utility is not working.
I also tried to create the zip using simple java implementation and the resulting file works ok even with the graphical Archive Utility, so the problem is probably in implementation of node-archiver
/yazl
libraries. I also tried to create the zip via command line (zip file.zip -0 ...files
), and it can also be opened via Archive Utility.
What is the correct way to handle this situation? Is there some other node library that can produce ZIP64 format that can be opened via Archive Utility?
It is necessary to stream the zip file, not storing it on disk. I am running latest version of MacOS sierra (10.12.5 beta) and node 6.9.1.
...ANSWER
Answered 2017-May-21 at 17:38If anyone struggles with the same requirements as I did, check JSZip
library (https://stuk.github.io/jszip/). It can also work with node streams and is able to produce zip files larger than 4 GiB, that can be opened via MacOS Archive Utility. The only limitation of this is, that you can not have a file larger than 4 GiB, because of 32 bit CRC32 hash generation (but the zip file can be larger).
Here is a snippet of how you can use this library:
QUESTION
ANSWER
Answered 2017-Jan-28 at 08:52This turned out to be a bug in the sharp library, which has now been fixed here
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install node-archiver
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page