Same functionality as concat-stream #1

Closed
dmitrig01 opened this Issue Mar 4, 2014 · 1 comment

Comments

Projects
None yet
2 participants

What are the differences between this project and https://github.com/maxogden/concat-stream?

dmitrig01 referenced this issue in maxogden/concat-stream Mar 4, 2014

Closed

Same functionality as accum? #22

Owner

jeffbski commented Mar 5, 2014

They appear to be similar, however one of the original reasons for creating accum was to provide an easy way to accumulate a stream which might contain multibyte string which has been split across buffer packets in a stream.

The proper way to handle that is to concatenate all the buffers first, then convert to string, otherwise the conversion of individual packets will result in a different (corrupted) result string.

Since this was an easy mistake this module was created to make that and other accumulations easier.

Since I didn't have a test for that multibyte split, the original code had regressed over time, but after a review today, I added a test and restored that original use case.

From my review of concat-stream, it suffers from the same flaw (if a multibyte char is split between buffers, it will result with wrong corrupted string).

See multibyte char split test -858c22c

and the fix - 33d2961

jeffbski closed this Nov 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment