Last active
August 29, 2015 14:07
-
-
Save max-mapper/7ce42ec0d841f40488d2 to your computer and use it in GitHub Desktop.
Revisions
-
max-mapper revised this gist
Oct 20, 2014 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,15 @@ @mafintosh said most of this, I just wrote it down ## how to destroy/end streams in node >= 0.10 - usually you call `.destroy()` if it has `.destroy` - if it doesnt have `.destroy` you are out of luck and the stream should upgrade to use e.g. newer `through2` - in request you call `.abort()` (this should get fixed to use `.destroy()`) - `.end()` tries to end the stream gracefully ### what about close - usually no `.close` method exists except in FD backed streams (usually only `fs`). usually you would never call `.close()` ### what about events -
max-mapper created this gist
Oct 20, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ ## how to destroy/end streams in node >= 0.10 - usually you call `.destroy()` if it has `.destroy` - if it doesnt have `.destroy` you are out of luck and the stream should upgrade to use e.g. newer `through2` - in request you call `.abort()` (this should get fixed to use `.destroy()`) ### what about close, end - usually no `.close` method exists except in FD backed streams (usually only `fs`). usually you would never call `.close()` - `.end()` tries to end the stream gracefully ### what about events - `finish` event is emitted when a stream ends nicely (e.g. `stream.end()`) - `close` and `error` events are emitted when a stream ends due to failure (e.g. `stream.destroy()`) - `end` is emitted when a readable stream has no more data - `end` in streams2 behaves more like a flush event, it only gets emitted when the data has been read from the readable