mafintosh / tar-stream

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

extract halts unexpectedly if predecessor stream is unzipped #50

Closed chpio closed 5 years ago

chpio commented 8 years ago

hi,

i encountered a bug with this package:

https://gist.github.com/chpio/6d0cedae59d8416d0aed

ohh, i don't know if it's relevant, i noticed the stops occur after a large file entry.

mafintosh commented 8 years ago

you need to resume the content stream or pipe it somewhere

.on('entry', function (header, stream, next) {
  stream.resume()
  next()
})
chpio commented 8 years ago

ok, so the usage of the stream outside of the entry handler is unsupported? like passing it into another stream and consume it later?

mafintosh commented 8 years ago

no thats fully supported as long as you drain the stream at some point.

chpio commented 8 years ago

hmm, yeah, the problem is that "later"/"at some point" is never called if the stream is not consumed "early"

mafintosh commented 8 years ago

i'm not sure what you mean