GeezerVison is showing github.com — fix: replace @eggjs/yauzl with upstream yauzl 3.4.0, update yazl to 3… · node-modules/compressing@572a0ba
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: lib/tar/stream.js +8-2Lines changed: 8 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -127,9 +127,15 @@ class TarStream extends BaseStream { | 127 | 127 | const waitingEntry = this._waitingEntries.shift(); | 128 | 128 | if (waitingEntry) { | 129 | 129 | this.addEntry.apply(this, waitingEntry); | 130 | | - } else { | 131 | | - this._finalize(); | | 130 | + return; | 132 | 131 | } | | 132 | + // A caller adding entries back to back queues the later ones only after this | | 133 | + // returns, and for zip the finish callback runs synchronously, so finalizing | | 134 | + // here would close the archive after the first entry. Give the caller a tick. | | 135 | + setImmediate(() => { | | 136 | + if (this._processing || this._waitingEntries.length > 0) return; | | 137 | + this._finalize(); | | 138 | + }); | 133 | 139 | } | 134 | 140 |
| 135 | 141 | _finalize() { | |
Collapse file Copy file name to clipboardExpand all lines: lib/zip/uncompress_stream.js +6-2Lines changed: 6 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 3 | 3 | // https://github.com/thejoshwolfe/yauzl#no-streaming-unzip-api | 4 | 4 |
| 5 | 5 | const debug = require('util').debuglog('compressing/zip/uncompress_stream'); | 6 | | -const yauzl = require('@eggjs/yauzl'); | | 6 | +const yauzl = require('yauzl'); | 7 | 7 | const stream = require('stream'); | 8 | 8 | const UncompressBaseStream = require('../base_write_stream'); | 9 | 9 | const utils = require('../utils'); | @@ -125,7 +125,11 @@ class ZipUncompressStream extends UncompressBaseStream { | 125 | 125 | const placeholder = new stream.Readable({ read() {} }); | 126 | 126 | debug('directory, header: %j', header); | 127 | 127 | this.emit('entry', header, placeholder, next); | 128 | | - setImmediate(() => placeholder.emit('end')); | | 128 | + // Push EOF rather than emitting 'end' on a timer: a fabricated event fires | | 129 | + // whether or not the consumer has finished with the entry, so a listener | | 130 | + // that creates the directory asynchronously would see the next entry, a | | 131 | + // file inside that directory, arrive before the directory exists. | | 132 | + placeholder.push(null); | 129 | 133 | } | 130 | 134 | }) | 131 | 135 | .on('end', () => this._finalCallback()) | |
Collapse file Copy file name to clipboardExpand all lines: package.json +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 39 | 39 | }, | 40 | 40 | "homepage": "https://github.com/node-modules/compressing#readme", | 41 | 41 | "dependencies": { | 42 | | - "@eggjs/yauzl": "^2.11.0", | 43 | 42 | "flushwritable": "^1.0.0", | 44 | 43 | "get-ready": "^1.0.0", | 45 | 44 | "iconv-lite": "^0.7.0", | 46 | 45 | "streamifier": "^0.1.1", | 47 | 46 | "tar-stream": "^1.5.2", | 48 | | - "yazl": "^2.4.2" | | 47 | + "yauzl": "^3.4.0", | | 48 | + "yazl": "^3.3.1" | 49 | 49 | }, | 50 | 50 | "devDependencies": { | 51 | 51 | "@types/mocha": "10", | |
Collapse file Copy file name to clipboardExpand all lines: test/zip/uncompress_stream.test.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -52,7 +52,7 @@ describe('test/zip/uncompress_stream.test.js', () => { | 52 | 52 | const uncompressStream = new compressing.zip.UncompressStream(); | 53 | 53 | await assert.rejects(async () => { | 54 | 54 | await pipelinePromise(fs.createReadStream(sourceFile), uncompressStream); | 55 | | - }, /end of central directory record signature not found/); | | 55 | + }, /end of central directory record signature not found/i); | 56 | 56 | }); | 57 | 57 |
| 58 | 58 | it('should uncompress according to file path', done => { | |
|