Comparing version 1.3.0 to 1.4.0
@@ -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']) | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16014
15
328
122