diff options
Diffstat (limited to 'deps/npm/node_modules/pacote/lib/util/gunzip-maybe.js')
-rw-r--r-- | deps/npm/node_modules/pacote/lib/util/gunzip-maybe.js | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/deps/npm/node_modules/pacote/lib/util/gunzip-maybe.js b/deps/npm/node_modules/pacote/lib/util/gunzip-maybe.js deleted file mode 100644 index 055de2921a..0000000000 --- a/deps/npm/node_modules/pacote/lib/util/gunzip-maybe.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict' - -const duplex = require('mississippi').duplex -const through = require('mississippi').through -const zlib = require('zlib') - -function hasGzipHeader (c) { - return c[0] === 0x1F && c[1] === 0x8B && c[2] === 0x08 -} - -module.exports = gunzip -function gunzip () { - const stream = duplex() - const peeker = through((chunk, enc, cb) => { - const newStream = hasGzipHeader(chunk) - ? zlib.createGunzip() - : through() - stream.setReadable(newStream) - stream.setWritable(newStream) - stream.write(chunk) - }) - stream.setWritable(peeker) - return stream -} |