Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorForrest L Norvell <forrest@npmjs.com>2014-08-21 10:06:51 +0400
committerForrest L Norvell <forrest@npmjs.com>2014-08-21 10:06:51 +0400
commit05838743f01ccb8d2432b3858d66847002fb62df (patch)
treed30fe9ad7bb1d192bee198d9676bc6b700b9ffde /node_modules/tar
parentcdf3b0428bc0b0183fb41dcde9e34e8f42c5e3a7 (diff)
tar@1.0.1
Diffstat (limited to 'node_modules/tar')
-rw-r--r--node_modules/tar/package.json37
-rw-r--r--node_modules/tar/test/extract-move.js132
-rw-r--r--node_modules/tar/test/fixtures.tgzbin19205 -> 19352 bytes
-rw-r--r--node_modules/tar/test/pack-no-proprietary.js34
-rw-r--r--node_modules/tar/test/pack.js47
5 files changed, 234 insertions, 16 deletions
diff --git a/node_modules/tar/package.json b/node_modules/tar/package.json
index 89ac65cf5..207eaa1fd 100644
--- a/node_modules/tar/package.json
+++ b/node_modules/tar/package.json
@@ -6,7 +6,7 @@
},
"name": "tar",
"description": "tar for node",
- "version": "1.0.0",
+ "version": "1.0.1",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-tar.git"
@@ -17,22 +17,39 @@
},
"dependencies": {
"block-stream": "*",
- "fstream": "^1.0.0",
+ "fstream": "^1.0.2",
"inherits": "2"
},
"devDependencies": {
- "tap": "0.x",
- "rimraf": "1.x"
+ "graceful-fs": "^3.0.2",
+ "rimraf": "1.x",
+ "tap": "0.x"
},
"license": "BSD",
- "readme": "# node-tar\n\nTar for Node.js.\n\n[![NPM](https://nodei.co/npm/tar.png)](https://nodei.co/npm/tar/)\n\n## API\n\nSee `examples/` for usage examples.\n\n### var tar = require('tar')\n\nReturns an object with `.Pack`, `.Extract` and `.Parse` methods.\n\n### tar.Pack([properties])\n\nReturns a through stream. Use\n[fstream](https://npmjs.org/package/fstream) to write files into the\npack stream and you will receive tar archive data from the pack\nstream.\n\nThis only works with directories, it does not work with individual files.\n\nThe optional `properties` object are used to set properties in the tar\n'Global Extended Header'.\n\n### tar.Extract([options])\n\nReturns a through stream. Write tar data to the stream and the files\nin the tarball will be extracted onto the filesystem.\n\n`options` can be:\n\n```js\n{\n path: '/path/to/extract/tar/into',\n strip: 0, // how many path segments to strip from the root when extracting\n}\n```\n\n`options` also get passed to the `fstream.Writer` instance that `tar`\nuses internally.\n\n### tar.Parse()\n\nReturns a writable stream. Write tar data to it and it will emit\n`entry` events for each entry parsed from the tarball. This is used by\n`tar.Extract`.\n",
- "readmeFilename": "README.md",
- "gitHead": "49979621a55c73c3f668d8e01830eba1ea9df862",
+ "gitHead": "476bf6f5882b9c33d1cbf66f175d0f25e3981044",
"bugs": {
"url": "https://github.com/isaacs/node-tar/issues"
},
"homepage": "https://github.com/isaacs/node-tar",
- "_id": "tar@1.0.0",
- "_shasum": "36636d76e8ae12b4bc11a940ac606b5ca8a5fe1f",
- "_from": "tar@latest"
+ "_id": "tar@1.0.1",
+ "_shasum": "6075b5a1f236defe0c7e3756d3d9b3ebdad0f19a",
+ "_from": "tar@1.0.1",
+ "_npmVersion": "1.4.23",
+ "_npmUser": {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ },
+ "maintainers": [
+ {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ }
+ ],
+ "dist": {
+ "shasum": "6075b5a1f236defe0c7e3756d3d9b3ebdad0f19a",
+ "tarball": "http://registry.npmjs.org/tar/-/tar-1.0.1.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/tar/-/tar-1.0.1.tgz",
+ "readme": "ERROR: No README data found!"
}
diff --git a/node_modules/tar/test/extract-move.js b/node_modules/tar/test/extract-move.js
new file mode 100644
index 000000000..45400cd9b
--- /dev/null
+++ b/node_modules/tar/test/extract-move.js
@@ -0,0 +1,132 @@
+// Set the umask, so that it works the same everywhere.
+process.umask(parseInt('22', 8))
+
+var tap = require("tap")
+ , tar = require("../tar.js")
+ , fs = require("fs")
+ , gfs = require("graceful-fs")
+ , path = require("path")
+ , file = path.resolve(__dirname, "fixtures/dir.tar")
+ , target = path.resolve(__dirname, "tmp/extract-test")
+ , index = 0
+ , fstream = require("fstream")
+ , rimraf = require("rimraf")
+ , mkdirp = require("mkdirp")
+
+ , ee = 0
+ , expectEntries = [
+ {
+ "path" : "dir/",
+ "mode" : "750",
+ "type" : "5",
+ "depth" : undefined,
+ "size" : 0,
+ "linkpath" : "",
+ "nlink" : undefined,
+ "dev" : undefined,
+ "ino" : undefined
+ },
+ {
+ "path" : "dir/sub/",
+ "mode" : "750",
+ "type" : "5",
+ "depth" : undefined,
+ "size" : 0,
+ "linkpath" : "",
+ "nlink" : undefined,
+ "dev" : undefined,
+ "ino" : undefined
+ } ]
+
+function slow (fs, method, t1, t2) {
+ var orig = fs[method]
+ if (!orig) return null
+ fs[method] = function () {
+ var args = [].slice.call(arguments)
+ console.error("slow", method, args[0])
+ var cb = args.pop()
+
+ setTimeout(function () {
+ orig.apply(fs, args.concat(function(er, data) {
+ setTimeout(function() {
+ cb(er, data)
+ }, t2)
+ }))
+ }, t1)
+ }
+}
+
+// Make sure we get the graceful-fs that fstream is using.
+var gfs2
+try {
+ gfs2 = require("fstream/node_modules/graceful-fs")
+} catch (er) {}
+
+var slowMethods = ["chown", "chmod", "utimes", "lutimes"]
+slowMethods.forEach(function (method) {
+ var t1 = 500
+ var t2 = 0
+ slow(fs, method, t1, t2)
+ slow(gfs, method, t1, t2)
+ if (gfs2) {
+ slow(gfs2, method, t1, t2)
+ }
+})
+
+
+
+// The extract class basically just pipes the input
+// to a Reader, and then to a fstream.DirWriter
+
+// So, this is as much a test of fstream.Reader and fstream.Writer
+// as it is of tar.Extract, but it sort of makes sense.
+
+tap.test("preclean", function (t) {
+ rimraf.sync(target)
+ /mkdirp.sync(target)
+ t.pass("cleaned!")
+ t.end()
+})
+
+tap.test("extract test", function (t) {
+ var extract = tar.Extract(target)
+ var inp = fs.createReadStream(file)
+
+ // give it a weird buffer size to try to break in odd places
+ inp.bufferSize = 1234
+
+ inp.pipe(extract)
+
+ extract.on("end", function () {
+ rimraf.sync(target)
+
+ t.equal(ee, expectEntries.length, "should see "+ee+" entries")
+
+ // should get no more entries after end
+ extract.removeAllListeners("entry")
+ extract.on("entry", function (e) {
+ t.fail("Should not get entries after end!")
+ })
+
+ t.end()
+ })
+
+
+ extract.on("entry", function (entry) {
+ var found =
+ { path: entry.path
+ , mode: entry.props.mode.toString(8)
+ , type: entry.props.type
+ , depth: entry.props.depth
+ , size: entry.props.size
+ , linkpath: entry.props.linkpath
+ , nlink: entry.props.nlink
+ , dev: entry.props.dev
+ , ino: entry.props.ino
+ }
+
+ var wanted = expectEntries[ee ++]
+
+ t.equivalent(found, wanted, "tar entry " + ee + " " + wanted.path)
+ })
+})
diff --git a/node_modules/tar/test/fixtures.tgz b/node_modules/tar/test/fixtures.tgz
index 4501bcf22..f1676023a 100644
--- a/node_modules/tar/test/fixtures.tgz
+++ b/node_modules/tar/test/fixtures.tgz
Binary files differ
diff --git a/node_modules/tar/test/pack-no-proprietary.js b/node_modules/tar/test/pack-no-proprietary.js
index 5bf0e540f..d4b03a1fe 100644
--- a/node_modules/tar/test/pack-no-proprietary.js
+++ b/node_modules/tar/test/pack-no-proprietary.js
@@ -150,6 +150,38 @@ var tap = require("tap")
fill: '' } ]
, [ 'entry',
+ { path: 'fixtures/dir/',
+ mode: 488,
+ uid: uid,
+ gid: gid,
+ size: 0,
+ type: '5',
+ linkpath: '',
+ ustar: 'ustar\u0000',
+ ustarver: '00',
+ uname: '',
+ gname: '',
+ devmaj: 0,
+ devmin: 0,
+ fill: '' } ]
+
+ , [ 'entry',
+ { path: 'fixtures/dir/sub/',
+ mode: 488,
+ uid: uid,
+ gid: gid,
+ size: 0,
+ type: '5',
+ linkpath: '',
+ ustar: 'ustar\u0000',
+ ustarver: '00',
+ uname: '',
+ gname: '',
+ devmaj: 0,
+ devmin: 0,
+ fill: '' } ]
+
+ , [ 'entry',
{ path: 'fixtures/foo.js',
mode: 420,
uid: uid,
@@ -823,7 +855,7 @@ function runTest (t, doGH) {
t.equal(ev, wanted[0], "event type should be "+wanted[0])
if (ev !== wanted[0] || e.path !== wanted[1].path) {
- console.error(wanted)
+ console.error("wanted", wanted)
console.error([ev, e.props])
e.on("end", function () {
console.error(e.fields)
diff --git a/node_modules/tar/test/pack.js b/node_modules/tar/test/pack.js
index 0f5099458..bf033c129 100644
--- a/node_modules/tar/test/pack.js
+++ b/node_modules/tar/test/pack.js
@@ -178,6 +178,39 @@ var tap = require("tap")
fill: '' } ]
, [ 'entry',
+ { path: 'fixtures/dir/',
+ mode: 488,
+ uid: uid,
+ gid: gid,
+ size: 0,
+ type: '5',
+ linkpath: '',
+ ustar: 'ustar\u0000',
+ ustarver: '00',
+ uname: '',
+ gname: '',
+ devmaj: 0,
+ devmin: 0,
+ fill: '' } ]
+
+ , [ 'entry',
+ { path: 'fixtures/dir/sub/',
+ mode: 488,
+ uid: uid,
+ gid: gid,
+ size: 0,
+ type: '5',
+ linkpath: '',
+ ustar: 'ustar\u0000',
+ ustarver: '00',
+ uname: '',
+ gname: '',
+ devmaj: 0,
+ devmin: 0,
+ fill: '' } ]
+
+
+ , [ 'entry',
{ path: 'fixtures/foo.js',
mode: 420,
uid: uid,
@@ -868,11 +901,15 @@ function runTest (t, doGH) {
}
t.equal(ev, wanted[0], "event type should be "+wanted[0])
- // if (ev !== wanted[0] || e.path !== wanted[1].path) {
- // console.error(wanted)
- // console.error([ev, e.props])
- // throw "break"
- // }
+ if (ev !== wanted[0] || e.path !== wanted[1].path) {
+ console.error("wanted", wanted)
+ console.error([ev, e.props])
+ e.on("end", function () {
+ console.error(e.fields)
+ throw "break"
+ })
+ }
+
t.has(e.props, wanted[1], "properties "+wanted[1].path)
if (wanted[2]) {