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
74.6
Supply Chain
96.5
Quality
77.1
Maintenance
100
Vulnerability
99.3
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
2,827 Stars
924 Commits
219 Forks
29 Watching
13 Branches
37 Contributors
Updated on 28 Nov 2024
Minified
Minified + Gzipped
JavaScript (98.06%)
CSS (1.94%)
Cumulative downloads
Total Downloads
Last day
-4.4%
1,839,079
Compared to previous day
Last week
2.9%
10,369,020
Compared to previous week
Last month
6.3%
43,199,846
Compared to previous month
Last year
29.2%
455,445,816
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
1import fs from "fs"; 2import { ZipArchive } from "archiver"; 3 4// create a file to stream archive data to. 5const output = fs.createWriteStream(__dirname + "/example.zip"); 6const archive = new ZipArchive({ 7 zlib: { level: 9 }, // Sets the compression level. 8}); 9 10// listen for all archive data to be written 11// 'close' event is fired only when a file descriptor is involved 12output.on("close", function () { 13 console.log(archive.pointer() + " total bytes"); 14 console.log( 15 "archiver has been finalized and the output file descriptor has closed.", 16 ); 17}); 18 19// This event is fired when the data source is drained no matter what was the data source. 20// It is not part of this library but rather from the NodeJS Stream API. 21// @see: https://nodejs.org/api/stream.html#stream_event_end 22output.on("end", function () { 23 console.log("Data has been drained"); 24}); 25 26// good practice to catch warnings (ie stat failures and other non-blocking errors) 27archive.on("warning", function (err) { 28 if (err.code === "ENOENT") { 29 // log warning 30 } else { 31 // throw error 32 throw err; 33 } 34}); 35 36// good practice to catch this error explicitly 37archive.on("error", function (err) { 38 throw err; 39}); 40 41// pipe archive data to the file 42archive.pipe(output); 43 44// append a file from stream 45const file1 = __dirname + "/file1.txt"; 46archive.append(fs.createReadStream(file1), { name: "file1.txt" }); 47 48// append a file from string 49archive.append("string cheese!", { name: "file2.txt" }); 50 51// append a file from buffer 52const buffer3 = Buffer.from("buff it!"); 53archive.append(buffer3, { name: "file3.txt" }); 54 55// append a file 56archive.file("file1.txt", { name: "file4.txt" }); 57 58// append files from a sub-directory and naming it `new-subdir` within the archive 59archive.directory("subdir/", "new-subdir"); 60 61// append files from a sub-directory, putting its contents at the root of archive 62archive.directory("subdir/", false); 63 64// append files from a glob pattern 65archive.glob("file*.txt", { cwd: __dirname }); 66 67// finalize the archive (ie we are done appending files but streams have to finish yet) 68// 'close', 'end' or 'finish' may be fired right after calling this method so register to them beforehand 69archive.finalize();
Archiver ships with out of the box support for TAR and ZIP archives.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
1 existing vulnerabilities detected
Details
Reason
8 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 6
Reason
dependency not pinned by hash detected -- score normalized to 5
Details
Reason
Found 1/5 approved changesets -- score normalized to 2
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 2024-11-25
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