Errors from one thread to another do not apply to pipelines, so you must connect error listeners to both threads.
If the fs read stream has an error, if autoClose is true, it will be destroyed (it will clear and close the file descriptor). But the gzip stream will not be closed, so you must close it manually.
If gzip has an error, it just emits it. It will not be closed, and the read stream will not.
Looking at other streams, for example, fs write stream, if an error occurs during recording, it closes the stream available for writing, but the read stream will remain open.
So my recommendation is that you install an error handler in all of your threads and don’t rely on yourself to close the error, so call .close or .destroy for all errors.
To ensure that you are listening to all error handlers, use domains .
source share