Skip to content
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

How to know Buffer.toString() consumed how many bytes? #4755

Closed
heroboy opened this issue Jan 19, 2016 · 2 comments
Closed

How to know Buffer.toString() consumed how many bytes? #4755

heroboy opened this issue Jan 19, 2016 · 2 comments
Labels
buffer Issues and PRs related to the buffer subsystem. question Issues that look for answers.

Comments

@heroboy
Copy link

heroboy commented Jan 19, 2016

Now I need to call Buffer.length - Buffer.byteLength(str). It looks like not efficient.
And it makes hard to correctly convert chunks to string in TransformStream.

@mscdex mscdex added question Issues that look for answers. buffer Issues and PRs related to the buffer subsystem. labels Jan 19, 2016
@bnoordhuis
Copy link
Member

I think you answered your own question? If you're doing partial writes, use a require('string_decoder').StringDecoder.

Can you direct support questions to SO or help next time? Thanks.

@heroboy
Copy link
Author

heroboy commented Jan 19, 2016

Sorry. Because I didn't find a similar link in page: https://nodejs.org/en/get-involved/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buffer Issues and PRs related to the buffer subsystem. question Issues that look for answers.
Projects
None yet
Development

No branches or pull requests

3 participants