-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: automatic string decoding for writable streams #7315
Comments
Support decoding the input of writable streams to a specific decoding before passing it to `_write()`. By default, all data written to a writable stream is encoded into Buffers. This change enables the reverse situation, i.e. when it is desired by the stream implementer to process all input as strings, whether it was passed to `write()` as a string or not. This makes sense for multi-byte character encodings where the buffers that are written using `write()` may contain partial characters, so calling `chunk.toString()` is not universally applicable. Fixes: nodejs#7315
@nodejs/streams |
This would be very nice to have, if someone would like to take it. Happy to coach, but it is tricky to implement. #7425 has an original implementation which we need to be rechecked for performance regressions. If there are none, we are 👍 . A very important thing to do would be to document how to do the boilerplate. See https://github.com/mcollina/split2/blob/master/index.js as an example. |
See #15369. |
Put into https://github.com/nodejs/node/projects/13 backlog |
It would be nice if
Writable
streams had a configuration option to decode buffers to strings (using aStringDecoder
instance). This is handy for example when writing aTransform
stream that takes utf8 input.Currently you have to set up your own
StringDecoder
instance and write the data through that first, which is kind of annoying. For non-multibyte encodings this isn't necessary though since you can justchunk.toString()
inside your_write()
/_transform()
handler.The text was updated successfully, but these errors were encountered: