node-unzipper
node-unzipper copied to clipboard
TypeError: Cannot read property 'objectMode' of undefined at DuplexWrapper.Writable.write
Sometimes when I am unzipping a file on disk I am seeing this error
TypeError: Cannot read property 'objectMode' of undefined
at DuplexWrapper.Writable.write (/Users/davethomas/{REMOVED PATH}/node_modules/readable-stream/lib/_stream_writable.js:317:22)
at ReadStream.ondata (_stream_readable.js:713:22)
at ReadStream.emit (events.js:314:20)
at addChunk (_stream_readable.js:303:12)
at readableAddChunk (_stream_readable.js:279:9)
at ReadStream.Readable.push (_stream_readable.js:218:10)
at internal/fs/streams.js:226:14
at FSReqCallback.wrapper [as oncomplete] (fs.js:528:5)
[nodemon] app crashed - waiting for file changes before starting...
^C
I am calling the unzipper code this way
async extract(zipFile, location) {
return new Promise((resolve, reject) => {
this.log('Extracting ' + zipFile)
fs.createReadStream(zipFile)
.pipe(unzip.Extract({ path: location }))
.on('error', err => reject(err))
.on('close', () => {
fs.unlinkSync(zipFile)
resolve()
})
})
}