tar 0.1.19 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/examples/packer.js +10 -0
- package/lib/parse.js +4 -3
- package/package.json +3 -3
- package/test/extract.js +16 -7
package/README.md
CHANGED
|
@@ -19,6 +19,8 @@ Returns a through stream. Use
|
|
|
19
19
|
pack stream and you will receive tar archive data from the pack
|
|
20
20
|
stream.
|
|
21
21
|
|
|
22
|
+
This only works with directories, it does not work with individual files.
|
|
23
|
+
|
|
22
24
|
The optional `properties` object are used to set properties in the tar
|
|
23
25
|
'Global Extended Header'.
|
|
24
26
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var tar = require("../tar.js")
|
|
2
|
+
, fstream = require("fstream")
|
|
3
|
+
, fs = require("fs")
|
|
4
|
+
|
|
5
|
+
var dir_destination = fs.createWriteStream('dir.tar')
|
|
6
|
+
|
|
7
|
+
// This must be a "directory"
|
|
8
|
+
fstream.Reader({ path: __dirname, type: "Directory" })
|
|
9
|
+
.pipe(tar.Pack({ noProprietary: true }))
|
|
10
|
+
.pipe(dir_destination)
|
package/lib/parse.js
CHANGED
|
@@ -37,6 +37,7 @@ function Parse () {
|
|
|
37
37
|
me.readable = true
|
|
38
38
|
me._stream = new BlockStream(512)
|
|
39
39
|
me.position = 0
|
|
40
|
+
me._ended = false
|
|
40
41
|
|
|
41
42
|
me._stream.on("error", function (e) {
|
|
42
43
|
me.emit("error", e)
|
|
@@ -118,13 +119,13 @@ Parse.prototype._process = function (c) {
|
|
|
118
119
|
// so appending one tarball to another is technically valid.
|
|
119
120
|
// ending without the eof null blocks is not allowed, however.
|
|
120
121
|
if (zero) {
|
|
121
|
-
|
|
122
|
+
if (this._eofStarted)
|
|
123
|
+
this._ended = true
|
|
122
124
|
this._eofStarted = true
|
|
123
125
|
} else {
|
|
124
|
-
this.
|
|
126
|
+
this._eofStarted = false
|
|
125
127
|
this._startEntry(c)
|
|
126
128
|
}
|
|
127
|
-
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
this.position += 512
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
|
3
3
|
"name": "tar",
|
|
4
4
|
"description": "tar for node",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.20",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git://github.com/isaacs/node-tar.git"
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"test": "tap test/*.js"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"inherits": "2",
|
|
16
15
|
"block-stream": "*",
|
|
17
|
-
"fstream": "~0.1.
|
|
16
|
+
"fstream": "~0.1.28",
|
|
17
|
+
"inherits": "2"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"tap": "0.x",
|
package/test/extract.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Set the umask, so that it works the same everywhere.
|
|
2
|
+
process.umask(parseInt('22', 8))
|
|
3
|
+
|
|
1
4
|
var tap = require("tap")
|
|
2
5
|
, tar = require("../tar.js")
|
|
3
6
|
, fs = require("fs")
|
|
@@ -114,6 +117,13 @@ var tap = require("tap")
|
|
|
114
117
|
size: 200,
|
|
115
118
|
linkpath: undefined,
|
|
116
119
|
nlink: 2 },
|
|
120
|
+
{ path: '/200LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL',
|
|
121
|
+
mode: '120755',
|
|
122
|
+
type: 'SymbolicLink',
|
|
123
|
+
depth: 1,
|
|
124
|
+
size: 200,
|
|
125
|
+
linkpath: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
126
|
+
nlink: 1 },
|
|
117
127
|
{ path: '/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
118
128
|
mode: '100644',
|
|
119
129
|
type: 'Link',
|
|
@@ -121,13 +131,6 @@ var tap = require("tap")
|
|
|
121
131
|
size: 200,
|
|
122
132
|
linkpath: path.join(target, '200-hard'),
|
|
123
133
|
nlink: 2 },
|
|
124
|
-
{ path: '/200LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL',
|
|
125
|
-
mode: '120777',
|
|
126
|
-
type: 'SymbolicLink',
|
|
127
|
-
depth: 1,
|
|
128
|
-
size: 200,
|
|
129
|
-
linkpath: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
|
|
130
|
-
nlink: 1 },
|
|
131
134
|
{ path: '/c.txt',
|
|
132
135
|
mode: '100644',
|
|
133
136
|
type: 'File',
|
|
@@ -280,6 +283,12 @@ var tap = require("tap")
|
|
|
280
283
|
// So, this is as much a test of fstream.Reader and fstream.Writer
|
|
281
284
|
// as it is of tar.Extract, but it sort of makes sense.
|
|
282
285
|
|
|
286
|
+
tap.test("preclean", function (t) {
|
|
287
|
+
require("rimraf").sync(__dirname + "/tmp/extract-test")
|
|
288
|
+
t.pass("cleaned!")
|
|
289
|
+
t.end()
|
|
290
|
+
})
|
|
291
|
+
|
|
283
292
|
tap.test("extract test", function (t) {
|
|
284
293
|
var extract = tar.Extract(target)
|
|
285
294
|
var inp = fs.createReadStream(file)
|