You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the code snippet of code example of Duplex Stream in Docs.
_write(chunk, encoding, callback) {
// The underlying source only deals with strings
if (Buffer.isBuffer(chunk))
chunk = chunk.toString(encoding);
this[kSource].writeSomeData(chunk, encoding);
callback();
}
If incoming chunk is an instance of Buffer, then encoding argument is supposed to be 'buffer' rather than String encoding types. So in this example, 'buffer' is passed as encoding into toString() and writeSomeData() methods instead of desired string encoding.
The text was updated successfully, but these errors were encountered:
mscdex
added
doc
Issues and PRs related to the documentations.
stream
Issues and PRs related to the stream subsystem.
labels
Aug 12, 2016
Fix cases where `chunk` is a buffer.
PR-URL: #8378Fixes: #8085
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
geek
pushed a commit
to geek/node
that referenced
this issue
Sep 30, 2016
Fix cases where `chunk` is a buffer.
PR-URL: nodejs#8378Fixes: nodejs#8085
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Fix cases where `chunk` is a buffer.
PR-URL: #8378Fixes: #8085
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This is the code snippet of code example of Duplex Stream in Docs.
If incoming
chunk
is an instance of Buffer, thenencoding
argument is supposed to be'buffer'
rather than String encoding types. So in this example,'buffer'
is passed asencoding
intotoString()
andwriteSomeData()
methods instead of desired string encoding.The text was updated successfully, but these errors were encountered: