Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tar-fs

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tar-fs - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

test/fixtures/d/file1

6

index.js

@@ -20,4 +20,4 @@ var tar = require('tar-stream')

var statAll = function(fs, cwd, ignore) {
var queue = ['.']
var statAll = function(fs, cwd, ignore, entries) {
var queue = entries || ['.']

@@ -63,3 +63,3 @@ return function loop(callback) {

var mapStream = opts.mapStream || echo
var statNext = statAll(xfs, cwd, ignore)
var statNext = statAll(xfs, cwd, ignore, opts.entries)
var strict = opts.strict !== false

@@ -66,0 +66,0 @@ var pack = tar.pack()

{
"name": "tar-fs",
"version": "1.3.0",
"version": "1.4.0",
"description": "filesystem bindings for tar-stream",

@@ -5,0 +5,0 @@ "repository": {

@@ -42,2 +42,10 @@ # tar-fs

You can also specify which entries to pack using the `entries` option
```js
var pack = tar.pack('./my-directory', {
entries: ['file1', 'subdir/file2'] // only the specific entries will be packed
})
```
If you want to modify the headers when packing/extracting add a map function to the options

@@ -44,0 +52,0 @@

@@ -127,2 +127,26 @@ var test = require('tape')

})
})
})
test('specific entries', function(t) {
t.plan(6)
var a = path.join(__dirname, 'fixtures', 'd')
var b = path.join(__dirname, 'fixtures', 'copy', 'd-entries')
var entries = [ 'file1', 'sub-files/file3', 'sub-dir' ]
rimraf.sync(b)
tar.pack(a, { entries: entries })
.pipe(tar.extract(b))
.on('finish', function() {
var files = fs.readdirSync(b)
t.same(files.length, 3)
t.notSame(files.indexOf('file1'), -1)
t.notSame(files.indexOf('sub-files'), -1)
t.notSame(files.indexOf('sub-dir'), -1)
var subFiles = fs.readdirSync(path.join(b, 'sub-files'))
t.same(subFiles, ['file3'])
var subDir = fs.readdirSync(path.join(b, 'sub-dir'))
t.same(subDir, ['file5'])
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc