tar 3.1.8 → 3.1.9
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/lib/parse.js +10 -2
- package/lib/unpack.js +7 -5
- package/package.json +1 -1
package/lib/parse.js
CHANGED
|
@@ -56,19 +56,27 @@ const BUFFERCONCAT = Symbol('bufferConcat')
|
|
|
56
56
|
const MAYBEEND = Symbol('maybeEnd')
|
|
57
57
|
const WRITING = Symbol('writing')
|
|
58
58
|
const ABORTED = Symbol('aborted')
|
|
59
|
+
const DONE = Symbol('onDone')
|
|
59
60
|
|
|
60
61
|
const noop = _ => true
|
|
61
62
|
|
|
62
63
|
module.exports = warner(class Parser extends EE {
|
|
63
64
|
constructor (opt) {
|
|
64
|
-
const start = process.hrtime()
|
|
65
65
|
opt = opt || {}
|
|
66
66
|
super(opt)
|
|
67
67
|
|
|
68
|
+
if (opt.ondone)
|
|
69
|
+
this.on(DONE, opt.ondone)
|
|
70
|
+
else
|
|
71
|
+
this.on(DONE, _ => (this.emit('end'), this.emit('close')))
|
|
72
|
+
|
|
68
73
|
this.strict = !!opt.strict
|
|
69
74
|
this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize
|
|
70
75
|
this.filter = typeof opt.filter === 'function' ? opt.filter : noop
|
|
71
76
|
|
|
77
|
+
// have to set this so that streams are ok piping into it
|
|
78
|
+
this.writable = true
|
|
79
|
+
|
|
72
80
|
this[QUEUE] = new Yallist()
|
|
73
81
|
this[BUFFER] = null
|
|
74
82
|
this[READENTRY] = null
|
|
@@ -321,7 +329,7 @@ module.exports = warner(class Parser extends EE {
|
|
|
321
329
|
entry.write(this[BUFFER])
|
|
322
330
|
entry.end()
|
|
323
331
|
}
|
|
324
|
-
this[EMIT](
|
|
332
|
+
this[EMIT](DONE)
|
|
325
333
|
}
|
|
326
334
|
}
|
|
327
335
|
|
package/lib/unpack.js
CHANGED
|
@@ -32,16 +32,18 @@ const DOCHOWN = Symbol('doChown')
|
|
|
32
32
|
|
|
33
33
|
class Unpack extends Parser {
|
|
34
34
|
constructor (opt) {
|
|
35
|
-
super(opt)
|
|
36
35
|
if (!opt)
|
|
37
36
|
opt = {}
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
this[ENDED] = false
|
|
41
|
-
this.on('end', _ => {
|
|
38
|
+
opt.ondone = _ => {
|
|
42
39
|
this[ENDED] = true
|
|
43
40
|
this[MAYBECLOSE]()
|
|
44
|
-
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
super(opt)
|
|
44
|
+
|
|
45
|
+
this[PENDING] = 0
|
|
46
|
+
this[ENDED] = false
|
|
45
47
|
|
|
46
48
|
this.dirCache = opt.dirCache || new Map()
|
|
47
49
|
|
package/package.json
CHANGED