Skip to content

Throws error in node v8.0.0 #236

@jwhitmarsh

Description

@jwhitmarsh

Code:

const archive = archiver.create(`zip`, {});
archive.append(`test`, { name: `test.pdf` });
archive.finalize();

const writeStream = createWriteStream(`test.zip`);
await new Promise(function(resolve, reject) {
  writeStream.on(`close`, function() {
    console.log(archive.pointer() + ` total bytes`);
    console.log(`archiver has been finalized and the output file descriptor has closed.`);
    resolve();
  });
  writeStream.on(`error`, reject);

  archive.pipe(writeStream);
});

Throws:

_stream_readable.js:545
  switch (state.pipesCount) {
               ^

TypeError: Cannot read property 'pipesCount' of undefined
    at module.exports.Readable.pipe (_stream_readable.js:545:16)
    at module.exports.ZipArchiveOutputStream._smartStream (/Users/.../node_modules/compress-commons/lib/archivers/zip/zip-archive-output-stream.js:184:11)
    at module.exports.ZipArchiveOutputStream._appendBuffer (/Users/.../node_modules/compress-commons/lib/archivers/zip/zip-archive-output-stream.js:82:10)
    at module.exports.ArchiveOutputStream.entry (/Users/.../node_modules/compress-commons/lib/archivers/archive-output-stream.js:86:10)
    at module.exports.ZipStream.entry (/Users/.../node_modules/zip-stream/index.js:138:49)
    at Zip.append (/Users/.../node_modules/archiver/lib/plugins/zip.js:53:15)
    at Archiver._moduleAppend (/Users/.../node_modules/archiver/lib/core.js:172:16)
    at Archiver._onQueueTask (/Users/.../node_modules/archiver/lib/core.js:370:8)
    at /Users/.../node_modules/async/dist/async.js:4045:9
    at process (/Users/.../node_modules/async/dist/async.js:2316:17)
    at Immediate._onImmediate (/Users/.../node_modules/async/dist/async.js:66:16)
    at runCallback (timers.js:800:20)
    at tryOnImmediate (timers.js:762:5)
    at processImmediate [as _immediateCallback] (timers.js:733:5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions