Gathering detailed insights and metrics for archiver
Gathering detailed insights and metrics for archiver
Gathering detailed insights and metrics for archiver
Gathering detailed insights and metrics for archiver
npm install archiver
Typescript
Module System
Min. Node Version
Node Version
NPM Version
94.9
Supply Chain
96.5
Quality
74.7
Maintenance
100
Vulnerability
99.3
License
JavaScript (98.06%)
CSS (1.94%)
Total Downloads
1,850,487,319
Last Day
2,138,942
Last Week
11,195,093
Last Month
48,306,443
Last Year
508,012,028
MIT License
2,870 Stars
930 Commits
225 Forks
28 Watchers
13 Branches
37 Contributors
Updated on May 05, 2025
Minified
Minified + Gzipped
Latest Version
7.0.1
Package Id
archiver@7.0.1
Unpacked Size
42.07 kB
Size
10.14 kB
File Count
9
NPM Version
8.19.4
Node Version
16.20.2
Published on
Mar 10, 2024
Cumulative downloads
Total Downloads
Last Day
53%
2,138,942
Compared to previous day
Last Week
5%
11,195,093
Compared to previous week
Last Month
-4.3%
48,306,443
Compared to previous month
Last Year
29.3%
508,012,028
Compared to previous year
A streaming interface for archive generation
Visit the API documentation for a list of all methods available.
1npm install archiver --save
1// require modules 2const fs = require('fs'); 3const archiver = require('archiver'); 4 5// create a file to stream archive data to. 6const output = fs.createWriteStream(__dirname + '/example.zip'); 7const archive = archiver('zip', { 8 zlib: { level: 9 } // Sets the compression level. 9}); 10 11// listen for all archive data to be written 12// 'close' event is fired only when a file descriptor is involved 13output.on('close', function() { 14 console.log(archive.pointer() + ' total bytes'); 15 console.log('archiver has been finalized and the output file descriptor has closed.'); 16}); 17 18// This event is fired when the data source is drained no matter what was the data source. 19// It is not part of this library but rather from the NodeJS Stream API. 20// @see: https://nodejs.org/api/stream.html#stream_event_end 21output.on('end', function() { 22 console.log('Data has been drained'); 23}); 24 25// good practice to catch warnings (ie stat failures and other non-blocking errors) 26archive.on('warning', function(err) { 27 if (err.code === 'ENOENT') { 28 // log warning 29 } else { 30 // throw error 31 throw err; 32 } 33}); 34 35// good practice to catch this error explicitly 36archive.on('error', function(err) { 37 throw err; 38}); 39 40// pipe archive data to the file 41archive.pipe(output); 42 43// append a file from stream 44const file1 = __dirname + '/file1.txt'; 45archive.append(fs.createReadStream(file1), { name: 'file1.txt' }); 46 47// append a file from string 48archive.append('string cheese!', { name: 'file2.txt' }); 49 50// append a file from buffer 51const buffer3 = Buffer.from('buff it!'); 52archive.append(buffer3, { name: 'file3.txt' }); 53 54// append a file 55archive.file('file1.txt', { name: 'file4.txt' }); 56 57// append files from a sub-directory and naming it `new-subdir` within the archive 58archive.directory('subdir/', 'new-subdir'); 59 60// append files from a sub-directory, putting its contents at the root of archive 61archive.directory('subdir/', false); 62 63// append files from a glob pattern 64archive.glob('file*.txt', {cwd:__dirname}); 65 66// finalize the archive (ie we are done appending files but streams have to finish yet) 67// 'close', 'end' or 'finish' may be fired right after calling this method so register to them beforehand 68archive.finalize();
Archiver ships with out of the box support for TAR and ZIP archives.
You can register additional formats with registerFormat
.
You can check if format already exists before to register a new one with isRegisteredFormat
.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
1 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 5
Details
Reason
Found 1/5 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-05-05
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More