Comparing version 2.0.1 to 2.1.0
@@ -91,5 +91,5 @@ // give it a tarball and a path, and it'll dump the contents | ||
var me = this | ||
if (!me._ended) me.error("unexpected eof") | ||
if (!me._ended || me._entry) me.error("unexpected eof") | ||
me._fst.end() | ||
// my .end() is coming later. | ||
} |
@@ -134,3 +134,8 @@ // pipe in an fstream, and it'll make a tarball. | ||
var root = path.dirname((entry.root || entry).path) | ||
var root = path.dirname((entry.root || entry).path); | ||
if (me._global && me._global.fromBase && entry.root && entry.root.path) { | ||
// user set 'fromBase: true' indicating tar root should be directory itself | ||
root = entry.root.path; | ||
} | ||
var wprops = {} | ||
@@ -137,0 +142,0 @@ |
@@ -64,3 +64,3 @@ | ||
var me = this | ||
if (!me._ended) me.error("unexpected eof") | ||
if (!me._ended || me._entry) me.error("unexpected eof") | ||
me.emit("end") | ||
@@ -67,0 +67,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"description": "tar for node", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
@@ -25,3 +25,5 @@ # node-tar | ||
The optional `properties` object are used to set properties in the tar | ||
'Global Extended Header'. | ||
'Global Extended Header'. If the `fromBase` property is set to true, | ||
the tar will contain files relative to the path passed, and not with | ||
the path included. | ||
@@ -28,0 +30,0 @@ ### tar.Extract([options]) |
@@ -833,2 +833,6 @@ | ||
tap.test("with from base", { timeout: 10000 }, function (t) { | ||
runTest(t, true, true) | ||
}) | ||
function alphasort (a, b) { | ||
@@ -843,3 +847,3 @@ return a === b ? 0 | ||
function runTest (t, doGH) { | ||
function runTest (t, doGH, doFromBase) { | ||
var reader = Reader({ path: input | ||
@@ -852,3 +856,6 @@ , filter: function () { | ||
var pack = Pack(doGH ? pkg : null) | ||
var props = doGH ? pkg : {} | ||
if(doFromBase) props.fromBase = true; | ||
var pack = Pack(props) | ||
var writer = Writer(target) | ||
@@ -907,2 +914,13 @@ | ||
if(doFromBase) { | ||
if(wanted[1].path.indexOf('fixtures/') && wanted[1].path.length == 100) | ||
wanted[1].path = wanted[1].path.replace('fixtures/', '') + 'ccccccccc' | ||
if(wanted[1]) wanted[1].path = wanted[1].path.replace('fixtures/', '').replace('//', '/') | ||
if(wanted[1].path == '') wanted[1].path = '/' | ||
if(wanted[2] && wanted[2].path) wanted[2].path = wanted[2].path.replace('fixtures', '').replace(/^\//, '') | ||
wanted[1].linkpath = wanted[1].linkpath.replace('fixtures/', '') | ||
} | ||
if (ev !== wanted[0] || e.path !== wanted[1].path) { | ||
@@ -909,0 +927,0 @@ console.error("wanted", wanted) |
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
164285
32
4588
51
24