Gathering detailed insights and metrics for @dylanvann/tar-fs
Gathering detailed insights and metrics for @dylanvann/tar-fs
npm install @dylanvann/tar-fs
Typescript
Module System
Node Version
NPM Version
69.8
Supply Chain
98.8
Quality
74.1
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
697
Last Day
1
Last Week
3
Last Month
8
Last Year
91
354 Stars
183 Commits
77 Forks
7 Watching
1 Branches
25 Contributors
Latest Version
2.0.1
Package Id
@dylanvann/tar-fs@2.0.1
Unpacked Size
17.26 kB
Size
5.58 kB
File Count
5
NPM Version
6.13.6
Node Version
12.14.1
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
50%
3
Compared to previous week
Last month
33.3%
8
Compared to previous month
Last year
-34.5%
91
Compared to previous year
filesystem bindings for tar-stream.
npm install tar-fs
tar-fs allows you to pack directories into tarballs and extract tarballs into directories.
It doesn't gunzip for you, so if you want to extract a .tar.gz
with this you'll need to use something like gunzip-maybe in addition to this.
1var tar = require('tar-fs') 2var fs = require('fs') 3 4// packing a directory 5tar.pack('./my-directory').pipe(fs.createWriteStream('my-tarball.tar')) 6 7// extracting a directory 8fs.createReadStream('my-other-tarball.tar').pipe(tar.extract('./my-other-directory'))
To ignore various files when packing or extracting add a ignore function to the options. ignore
is also an alias for filter
. Additionally you get header
if you use ignore while extracting.
That way you could also filter by metadata.
1var pack = tar.pack('./my-directory', { 2 ignore: function(name) { 3 return path.extname(name) === '.bin' // ignore .bin files when packing 4 } 5}) 6 7var extract = tar.extract('./my-other-directory', { 8 ignore: function(name) { 9 return path.extname(name) === '.bin' // ignore .bin files inside the tarball when extracing 10 } 11}) 12 13var extractFilesDirs = tar.extract('./my-other-other-directory', { 14 ignore: function(_, header) { 15 // pass files & directories, ignore e.g. symlinks 16 return header.type !== 'file' && header.type !== 'directory' 17 } 18})
You can also specify which entries to pack using the entries
option
1var pack = tar.pack('./my-directory', { 2 entries: ['file1', 'subdir/file2'] // only the specific entries will be packed 3})
If you want to modify the headers when packing/extracting add a map function to the options
1var pack = tar.pack('./my-directory', { 2 map: function(header) { 3 header.name = 'prefixed/'+header.name 4 return header 5 } 6}) 7 8var extract = tar.extract('./my-directory', { 9 map: function(header) { 10 header.name = 'another-prefix/'+header.name 11 return header 12 } 13})
Similarly you can use mapStream
incase you wanna modify the input/output file streams
1var pack = tar.pack('./my-directory', { 2 mapStream: function(fileStream, header) { 3 if (path.extname(header.name) === '.js') { 4 return fileStream.pipe(someTransform) 5 } 6 return fileStream; 7 } 8}) 9 10var extract = tar.extract('./my-directory', { 11 mapStream: function(fileStream, header) { 12 if (path.extname(header.name) === '.js') { 13 return fileStream.pipe(someTransform) 14 } 15 return fileStream; 16 } 17})
Set options.fmode
and options.dmode
to ensure that files/directories extracted have the corresponding modes
1var extract = tar.extract('./my-directory', { 2 dmode: parseInt(555, 8), // all dirs should be readable 3 fmode: parseInt(444, 8) // all files should be readable 4})
It can be useful to use dmode
and fmode
if you are packing/unpacking tarballs between *nix/windows to ensure that all files/directories unpacked are readable.
Alternatively you can set options.readable
and/or options.writable
to set the dmode and fmode to readable/writable.
1var extract = tar.extract('./my-directory', { 2 readable: true, // all dirs and files should be readable 3 writable: true, // all dirs and files should be writable 4})
Set options.strict
to false
if you want to ignore errors due to unsupported entry types (like device files)
To dereference symlinks (pack the contents of the symlink instead of the link itself) set options.dereference
to true
.
Copying a directory with permissions and mtime intact is as simple as
1tar.pack('source-directory').pipe(tar.extract('dest-directory'))
tar-stream
Use finalize: false
and the finish
hook to
leave the pack stream open for further entries (see
tar-stream#pack
),
and use pack
to pass an existing pack stream.
1var mypack = tar.pack('./my-directory', { 2 finalize: false, 3 finish: function(sameAsMypack) { 4 mypack.entry({name: 'generated-file.txt'}, "hello") 5 tar.pack('./other-directory', { 6 pack: sameAsMypack 7 }) 8 } 9})
Packing and extracting a 6.1 GB with 2496 directories and 2398 files yields the following results on my Macbook Air. See the benchmark here
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
4 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 5
Reason
Found 5/30 approved changesets -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-01-27
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