diff --git a/doc/api/stream.md b/doc/api/stream.md index 01405556674..252ed15ceae 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -354,6 +354,19 @@ buffered writes in a more optimized manner. See also: [`writable.uncork()`][]. +##### writable.destroy([error]) + + +* Returns: {this} + +Destroy the stream, and emit the passed `error` and a `close` event. +After this call, the writable stream has ended and subsequent calls +to `write` / `end` will give an `ERR_STREAM_DESTROYED` error. +Implementors should not override this method, +but instead implement [`writable._destroy`][writable-_destroy]. + ##### writable.end([chunk][, encoding][, callback]) - -* Returns: {this} - -Destroy the stream, and emit the passed `error` and a `close` event. -After this call, the writable stream has ended and subsequent calls -to `write` / `end` will give an `ERR_STREAM_DESTROYED` error. -Implementors should not override this method, -but instead implement [`writable._destroy`][writable-_destroy]. - ### Readable Streams Readable streams are an abstraction for a *source* from which data is @@ -806,6 +806,20 @@ In general, the `readable.pipe()` and `'data'` event mechanisms are easier to understand than the `'readable'` event. However, handling `'readable'` might result in increased throughput. +##### readable.destroy([error]) + + +* `error` {Error} Error which will be passed as payload in `'error'` event +* Returns: {this} + +Destroy the stream, and emit `'error'` and `close`. After this call, the +readable stream will release any internal resources and subsequent calls +to `push` will be ignored. +Implementors should not override this method, but instead implement +[`readable._destroy`][readable-_destroy]. + ##### readable.isPaused() - -* Returns: {number} - -Returns the value of `highWaterMark` passed when constructing this -`Readable`. - ##### readable.read([size]) + +* Returns: {number} + +Returns the value of `highWaterMark` passed when constructing this +`Readable`. + ##### readable.readableLength - -* `error` {Error} Error which will be passed as payload in `'error'` event -* Returns: {this} - -Destroy the stream, and emit `'error'` and `close`. After this call, the -readable stream will release any internal resources and subsequent calls -to `push` will be ignored. -Implementors should not override this method, but instead implement -[`readable._destroy`][readable-_destroy]. - ##### readable[@@asyncIterator]