The errors from one stream to another is not propagated on piping, so you should be attaching the error listeners to both streams.
If the fs read stream has an error, if autoClose is true then it will be destroyed(it will clean up and close the file descriptor). But the gzip stream won't be closed so you have to close it manually.
If the gzip has an error, it will just emit it. It won't be closed, nor the readable stream will be.
Looking at other streams, like fs write stream, if an error happens on the writing, then it will close the writable stream, but the readable stream will stay open.
So my recommendation is that, set error handler on all your streams and don't rely on themselves closing on error, so call .close
or .destroy
on all errors.
To make sure you are listening on all error handlers, use domains.