So the "fast" way of converting a multi-buffer stream back into a string
would be to use string decoder, and convert each chunk, then concat the
strings right?  In v8, the strings are actually cons-strings, so adding 2
strings together should be an O(1) operation right?


On Sat, May 19, 2012 at 5:24 AM, Mattias Ernelli <[email protected]>wrote:

> No i dont think, that's the way its done, since it would be very
> inefficient and each chunk is converted to a string directly.
>
> I Believe that string decoder checks the end of each chunk to see if any
> multibyte char is straddling, very easy check in utf8 encoding, and
> excludes the partial char from conversion, saves it in a local char buffer
> and concatenates it with the remaining bytes in the next chunk.
>
> Now the only thing i need to figure out is how to convert a binary buffer
> to internal utf8 encoded string without looping through all bytes in the
> chunk in JS.
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to