Skip to content

Commit 68a2d8f

Browse files
vovacodespiscisaureus
authored andcommitted
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: #142 Reviewed-by: Bert Belder <[email protected]> Reviewed-by: Rod Vagg <[email protected]>
1 parent 43e4c90 commit 68a2d8f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

doc/api/stream.markdown

+6-6
Original file line numberDiff line numberDiff line change
@@ -1038,12 +1038,11 @@ initialized.
10381038

10391039
#### writable.\_write(chunk, encoding, callback)
10401040

1041-
* `chunk` {Buffer | String} The chunk to be written. Will always
1041+
* `chunk` {Buffer | String} The chunk to be written. Will **always**
10421042
be a buffer unless the `decodeStrings` option was set to `false`.
10431043
* `encoding` {String} If the chunk is a string, then this is the
1044-
encoding type. Ignore if chunk is a buffer. Note that chunk will
1045-
**always** be a buffer unless the `decodeStrings` option is
1046-
explicitly set to `false`.
1044+
encoding type. If chunk is a buffer, then this is the special
1045+
value - 'buffer', ignore it in this case.
10471046
* `callback` {Function} Call this function (optionally with an error
10481047
argument) when you are done processing the supplied chunk.
10491048

@@ -1150,10 +1149,11 @@ initialized.
11501149

11511150
#### transform.\_transform(chunk, encoding, callback)
11521151

1153-
* `chunk` {Buffer | String} The chunk to be transformed. Will always
1152+
* `chunk` {Buffer | String} The chunk to be transformed. Will **always**
11541153
be a buffer unless the `decodeStrings` option was set to `false`.
11551154
* `encoding` {String} If the chunk is a string, then this is the
1156-
encoding type. (Ignore if `decodeStrings` chunk is a buffer.)
1155+
encoding type. If chunk is a buffer, then this is the special
1156+
value - 'buffer', ignore it in this case.
11571157
* `callback` {Function} Call this function (optionally with an error
11581158
argument and data) when you are done processing the supplied chunk.
11591159

0 commit comments

Comments
 (0)