This commit is contained in:
Mathias Buus 2018-04-27 17:40:46 +02:00
parent 689d3fafd5
commit 105192dc3d
2 changed files with 5 additions and 5 deletions

View file

@ -182,8 +182,8 @@ var Extract = function (opts) {
self._parse(header.size, onstreamend)
oncontinue()
}
this._onheader = onheader
this._onheader = onheader
this._parse(512, onheader)
}
@ -251,7 +251,7 @@ Extract.prototype._write = function (data, enc, cb) {
}
Extract.prototype._final = function (cb) {
if (this._partial) cb(new Error('unexpected end of data'))
if (this._partial) return this.destroy(new Error('Unexpected end of data'))
cb()
}

View file

@ -572,7 +572,7 @@ test('latin-1', function (t) { // can unpack filenames encoded in latin-1
})
test('incomplete', function (t) {
t.plan(2)
t.plan(1)
var extract = tar.extract()
@ -581,11 +581,11 @@ test('incomplete', function (t) {
})
extract.on('error', function (err) {
t.same(err.message, 'unexpected end of data')
t.same(err.message, 'Unexpected end of data')
})
extract.on('finish', function () {
t.ok(true)
t.fail('should not finish')
})
extract.end(fs.readFileSync(fixtures.INCOMPLETE_TAR))