mafintosh / tar-stream

tar-stream is a streaming tar parser and generator.
MIT License
406 stars 92 forks source link

Fix: Adds return statement to docs #104

Closed ff6347 closed 4 years ago

ff6347 commented 5 years ago

Shouldn't the extract function return stream.resume()?

mafintosh commented 5 years ago

Hmm, why would that be needed? Not sure I follow

ff6347 commented 5 years ago

Ill try to write a demo repo which shows my issue why I think this is needed

ff6347 commented 5 years ago

Hi. I made the demo repo under https://github.com/fabianmoronzirfas/tar-stream-pr-104-issue-demo

The problem I had was the following:

When extracting a folder of tar.gz files the module hung itself on the next element when I did not call.

// …
return estream.resume();
// …

Be aware that this error might be related to my noobness on tar and streams or also the complexity of the project where I used this.

Currently I get a different error related to #68 ?

events.js:173
      throw er; // Unhandled 'error' event
      ^

Error: Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?
    at Object.exports.decode (path/to/project/tar-stream-pr-104-issue-demo/node_modules/tar-stream/headers.js:266:43)
    at Extract.onheader (path/to/project/tar-stream-pr-104-issue-demo/node_modules/tar-stream/extract.js:123:39)
    at Extract._write (path/to/project/tar-stream-pr-104-issue-demo/node_modules/tar-stream/extract.js:249:8)
    at Extract._continue (path/to/project/tar-stream-pr-104-issue-demo/node_modules/tar-stream/extract.js:212:28)
    at oncontinue (path/to/project/tar-stream-pr-104-issue-demo/node_modules/tar-stream/extract.js:67:10)
    at Extract.ondrain (path/to/project/tar-stream-pr-104-issue-demo/node_modules/tar-stream/extract.js:87:5)
    at Extract._write (path/to/project/tar-stream-pr-104-issue-demo/node_modules/tar-stream/extract.js:249:8)
    at Extract._continue (path/to/project/tar-stream-pr-104-issue-demo/node_modules/tar-stream/extract.js:212:28)
    at oncontinue (path/to/project/tar-stream-pr-104-issue-demo/node_modules/tar-stream/extract.js:67:10)
    at onunlock (path/to/project/tar-stream-pr-104-issue-demo/node_modules/tar-stream/extract.js:73:24)
Emitted 'error' event at:
    at Extract.onerror (path/to/project/tar-stream-pr-104-issue-demo/node_modules/duplexify/node_modules/readable-stream/lib/_stream_readable.js:640:52)
    at Extract.emit (events.js:202:15)
    at Extract.onheader (path/to/project/tar-stream-pr-104-issue-demo/node_modules/tar-stream/extract.js:125:12)
    at Extract._write (path/to/project/tar-stream-pr-104-issue-demo/node_modules/tar-stream/extract.js:249:8)
    [... lines matching original stack trace ...]
    at oncontinue (path/to/project/tar-stream-pr-104-issue-demo/node_modules/tar-stream/extract.js:67:10)