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
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/fetch-package-metadata.js17
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/fetch-package-metadata.js b/lib/fetch-package-metadata.js
index 049dfb25f..6c41bfdf0 100644
--- a/lib/fetch-package-metadata.js
+++ b/lib/fetch-package-metadata.js
@@ -252,11 +252,6 @@ function hasTarHeader (c) {
c[264] === 0x00))
}
-function dispose (stream) {
- if (stream.destroy) return stream.destroy()
- if (stream.close) return stream.close()
-}
-
function untarStream (tarball, cb) {
validate('SF', arguments)
cb = once(cb)
@@ -275,7 +270,7 @@ function untarStream (tarball, cb) {
} else if (hasTarHeader(c)) {
doUntar()
} else {
- dispose(file)
+ file.close()
var er = new Error('Non-gzip/tarball ' + tarball)
er.code = 'ENOTTARBALL'
return cb(er)
@@ -292,7 +287,7 @@ function untarStream (tarball, cb) {
er.code = 'EGUNZIP'
cb(er)
})
- tounpipe.push(gunzip)
+ tounpipe.push([stream, gunzip])
stream = gunzip
doUntar()
}
@@ -304,16 +299,18 @@ function untarStream (tarball, cb) {
er.code = 'EUNTAR'
cb(er)
})
- tounpipe.push(untar)
+ tounpipe.push([stream, untar])
stream = untar
addClose()
}
function addClose () {
stream.close = function () {
- tounpipe.forEach(dispose)
+ tounpipe.forEach(function (streams) {
+ streams[0].unpipe(streams[1])
+ })
- dispose(file)
+ file.close()
}
}
}