Allow to stream symlink location if 'linkname' header field is not defined
This commit is contained in:
parent
b2f57d1b24
commit
b32e9b6b39
1 changed files with 27 additions and 2 deletions
29
pack.js
29
pack.js
|
@ -112,15 +112,40 @@ Pack.prototype.entry = function(header, buffer, callback) {
|
||||||
process.nextTick(callback)
|
process.nextTick(callback)
|
||||||
return new Void()
|
return new Void()
|
||||||
}
|
}
|
||||||
if (header.type !== 'file' && header.type !== 'contigious-file') {
|
|
||||||
|
if (header.type === 'symlink' && !header.linkname) {
|
||||||
|
var stream = new Writable
|
||||||
|
var linkname = ''
|
||||||
|
|
||||||
|
stream._write = function(data, enc, cb)
|
||||||
|
{
|
||||||
|
linkname += data
|
||||||
|
cb()
|
||||||
|
}
|
||||||
|
eos(stream, function(err)
|
||||||
|
{
|
||||||
|
if (err) { // stream was closed
|
||||||
|
self.destroy()
|
||||||
|
return callback(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
header.linkname = linkname
|
||||||
|
self._encode(header)
|
||||||
|
callback()
|
||||||
|
})
|
||||||
|
|
||||||
|
return stream
|
||||||
|
}
|
||||||
|
|
||||||
this._encode(header)
|
this._encode(header)
|
||||||
|
|
||||||
|
if (header.type !== 'file' && header.type !== 'contigious-file') {
|
||||||
process.nextTick(callback)
|
process.nextTick(callback)
|
||||||
return new Void()
|
return new Void()
|
||||||
}
|
}
|
||||||
|
|
||||||
var sink = new Sink(this)
|
var sink = new Sink(this)
|
||||||
|
|
||||||
this._encode(header)
|
|
||||||
this._stream = sink
|
this._stream = sink
|
||||||
|
|
||||||
eos(sink, function(err) {
|
eos(sink, function(err) {
|
||||||
|
|
Loading…
Reference in a new issue