docs: improve Writable/Transform stream docs
Slightly fix and supplement the documentation for Writable#write and Transform#transform methods. Make it more consistent. Mention passing 'buffer' as an encoding param in case chunk is a Buffer. PR: https://github.com/iojs/io.js/pull/142 Reviewed-by: Bert Belder <bertbelder@gmail.com> Reviewed-by: Rod Vagg <rod@vagg.org>
This commit is contained in:
parent
43e4c906e2
commit
68a2d8f048
@ -1038,12 +1038,11 @@ initialized.
|
|||||||
|
|
||||||
#### writable.\_write(chunk, encoding, callback)
|
#### writable.\_write(chunk, encoding, callback)
|
||||||
|
|
||||||
* `chunk` {Buffer | String} The chunk to be written. Will always
|
* `chunk` {Buffer | String} The chunk to be written. Will **always**
|
||||||
be a buffer unless the `decodeStrings` option was set to `false`.
|
be a buffer unless the `decodeStrings` option was set to `false`.
|
||||||
* `encoding` {String} If the chunk is a string, then this is the
|
* `encoding` {String} If the chunk is a string, then this is the
|
||||||
encoding type. Ignore if chunk is a buffer. Note that chunk will
|
encoding type. If chunk is a buffer, then this is the special
|
||||||
**always** be a buffer unless the `decodeStrings` option is
|
value - 'buffer', ignore it in this case.
|
||||||
explicitly set to `false`.
|
|
||||||
* `callback` {Function} Call this function (optionally with an error
|
* `callback` {Function} Call this function (optionally with an error
|
||||||
argument) when you are done processing the supplied chunk.
|
argument) when you are done processing the supplied chunk.
|
||||||
|
|
||||||
@ -1150,10 +1149,11 @@ initialized.
|
|||||||
|
|
||||||
#### transform.\_transform(chunk, encoding, callback)
|
#### transform.\_transform(chunk, encoding, callback)
|
||||||
|
|
||||||
* `chunk` {Buffer | String} The chunk to be transformed. Will always
|
* `chunk` {Buffer | String} The chunk to be transformed. Will **always**
|
||||||
be a buffer unless the `decodeStrings` option was set to `false`.
|
be a buffer unless the `decodeStrings` option was set to `false`.
|
||||||
* `encoding` {String} If the chunk is a string, then this is the
|
* `encoding` {String} If the chunk is a string, then this is the
|
||||||
encoding type. (Ignore if `decodeStrings` chunk is a buffer.)
|
encoding type. If chunk is a buffer, then this is the special
|
||||||
|
value - 'buffer', ignore it in this case.
|
||||||
* `callback` {Function} Call this function (optionally with an error
|
* `callback` {Function} Call this function (optionally with an error
|
||||||
argument and data) when you are done processing the supplied chunk.
|
argument and data) when you are done processing the supplied chunk.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user