* Destroy the stream * @param {Stream} stream * @return {Stream} * @author Jonathan Ong * @license MIT * @see https://github.com/stream-utils/destroy
(stream)
| 3213 | * @see {@link https://github.com/stream-utils/destroy} |
| 3214 | */ |
| 3215 | function destroyStream(stream) { |
| 3216 | if (stream instanceof ReadStream) { |
| 3217 | stream.destroy(); |
| 3218 | typeof(stream.close) === 'function' && stream.on('open', function() { |
| 3219 | typeof(this.fd) === 'number' && this.close(); |
| 3220 | }); |
| 3221 | } else if (stream instanceof Stream) |
| 3222 | typeof(stream.destroy) === 'function' && stream.destroy(); |
| 3223 | return stream; |
| 3224 | } |
| 3225 | |
| 3226 | function isFinished(stream) { |
| 3227 |