diff options
Diffstat (limited to 'node_modules/minizlib')
-rw-r--r-- | node_modules/minizlib/README.md | 7 | ||||
-rw-r--r-- | node_modules/minizlib/index.js | 24 | ||||
-rw-r--r-- | node_modules/minizlib/package.json | 79 |
3 files changed, 53 insertions, 57 deletions
diff --git a/node_modules/minizlib/README.md b/node_modules/minizlib/README.md index 4097b8522..80e067ab3 100644 --- a/node_modules/minizlib/README.md +++ b/node_modules/minizlib/README.md @@ -51,3 +51,10 @@ const decode = new zlib.BrotliDecompress() const output = whereToWriteTheDecodedData() input.pipe(decode).pipe(output) ``` + +## REPRODUCIBLE BUILDS + +To create reproducible gzip compressed files across different operating +systems, set `portable: true` in the options. This causes minizlib to set +the `OS` indicator in byte 9 of the extended gzip header to `0xFF` for +'unknown'. diff --git a/node_modules/minizlib/index.js b/node_modules/minizlib/index.js index 295047b9c..c84bda1b5 100644 --- a/node_modules/minizlib/index.js +++ b/node_modules/minizlib/index.js @@ -9,6 +9,7 @@ const Minipass = require('minipass') const OriginalBufferConcat = Buffer.concat +const _superWrite = Symbol('_superWrite') class ZlibError extends Error { constructor (err) { super('zlib: ' + err.message) @@ -164,12 +165,12 @@ class ZlibBase extends Minipass { if (Array.isArray(result) && result.length > 0) { // The first buffer is always `handle._outBuffer`, which would be // re-used for later invocations; so, we always have to copy that one. - writeReturn = super.write(Buffer.from(result[0])) + writeReturn = this[_superWrite](Buffer.from(result[0])) for (let i = 1; i < result.length; i++) { - writeReturn = super.write(result[i]) + writeReturn = this[_superWrite](result[i]) } } else { - writeReturn = super.write(Buffer.from(result)) + writeReturn = this[_superWrite](Buffer.from(result)) } } @@ -177,6 +178,10 @@ class ZlibBase extends Minipass { cb() return writeReturn } + + [_superWrite] (data) { + return super.write(data) + } } class Zlib extends ZlibBase { @@ -243,9 +248,22 @@ class Inflate extends Zlib { } // gzip - bigger header, same deflate compression +const _portable = Symbol('_portable') class Gzip extends Zlib { constructor (opts) { super(opts, 'Gzip') + this[_portable] = opts && !!opts.portable + } + + [_superWrite] (data) { + if (!this[_portable]) + return super[_superWrite](data) + + // we'll always get the header emitted in one first chunk + // overwrite the OS indicator byte with 0xFF + this[_portable] = false + data[9] = 255 + return super[_superWrite](data) } } diff --git a/node_modules/minizlib/package.json b/node_modules/minizlib/package.json index 5dbf11457..8cd68fa5f 100644 --- a/node_modules/minizlib/package.json +++ b/node_modules/minizlib/package.json @@ -1,49 +1,22 @@ { - "_from": "minizlib@^1.2.1", - "_id": "minizlib@1.3.3", - "_inBundle": false, - "_integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", - "_location": "/minizlib", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "minizlib@^1.2.1", - "name": "minizlib", - "escapedName": "minizlib", - "rawSpec": "^1.2.1", - "saveSpec": null, - "fetchSpec": "^1.2.1" - }, - "_requiredBy": [ - "/node-gyp/tar" - ], - "_resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", - "_shasum": "2290de96818a34c29551c8a8d301216bd65a861d", - "_spec": "minizlib@^1.2.1", - "_where": "/Users/isaacs/dev/npm/cli/node_modules/node-gyp/node_modules/tar", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/isaacs/minizlib/issues" - }, - "bundleDependencies": false, + "name": "minizlib", + "version": "2.1.0", + "description": "A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.", + "main": "index.js", "dependencies": { - "minipass": "^2.9.0" + "minipass": "^3.0.0", + "yallist": "^4.0.0" }, - "deprecated": false, - "description": "A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.", - "devDependencies": { - "tap": "^12.0.1" + "scripts": { + "test": "tap test/*.js --100 -J", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --all; git push origin --tags" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/minizlib.git" }, - "files": [ - "index.js", - "constants.js" - ], - "homepage": "https://github.com/isaacs/minizlib#readme", "keywords": [ "zlib", "gzip", @@ -54,18 +27,16 @@ "zip", "unzip" ], + "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", "license": "MIT", - "main": "index.js", - "name": "minizlib", - "repository": { - "type": "git", - "url": "git+https://github.com/isaacs/minizlib.git" - }, - "scripts": { - "postpublish": "git push origin --all; git push origin --tags", - "postversion": "npm publish", - "preversion": "npm test", - "test": "tap test/*.js --100 -J" + "devDependencies": { + "tap": "^14.6.9" }, - "version": "1.3.3" + "files": [ + "index.js", + "constants.js" + ], + "engines": { + "node": ">= 8" + } } |