Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,19 @@ file.end('world!');
// Writing more now is not allowed!
```

[`stream.end()`][stream-end] will call its callback and emit `'error'`
with (in order of precedence):
* `ERR_STREAM_WRITE_AFTER_END` if `chunk` is not nully and
[`stream.end()`][stream-end] has been called.
* `ERR_STREAM_DESTROYED` if `chunk` is not nully and
[`stream.destroy()`][writable-destroy] has been called.
* `ERR_INVALID_ARG_TYPE` if `chunk` is not nully and
`chunk` is not a `string` when not in `objectMode`.
* `ERR_STREAM_ALREADY_FINISHED` if
[`writable.writableFinished`][] is `true`.
* Last error emitted by the instance through `'error'` before
[`writable.writableFinished`][] is set to `true`.

##### writable.setDefaultEncoding(encoding)
<!-- YAML
added: v0.11.15
Expand Down Expand Up @@ -619,6 +632,15 @@ write('hello', () => {

A `Writable` stream in object mode will always ignore the `encoding` argument.

[`stream.write()`][stream-write] will call its callback and emit `'error'`
with (in order of precedence):
* `ERR_STREAM_WRITE_AFTER_END` if [`stream.end()`][stream-end] has been called.
* `ERR_STREAM_DESTROYED` if [`stream.destroy()`][writable-destroy] has been
called.
* `ERR_STREAM_NULL_VALUES` if `chunk` is `null`.
* `ERR_INVALID_ARG_TYPE` if `chunk` is not a `string` when not in `objectMode`.
* Any error forwarded from `writable._write()` or `writable._writev()`.

### Readable Streams

Readable streams are an abstraction for a *source* from which data is
Expand Down