Skip to content

Read big file issue with overflow #21

Description

@se-m

Node v 4.3.1
This code don`t work

if (overflow !== null) {
  buffer = overflow + buffer;
}

It actually decrease buffer length
This is my 2 chunks read log

read 65536
read + overflow 65536
record 93
overflow 86
read 65536
read + overflow 64298

The first record in 2nd chunk was parsed wrong.


Buffer.concat do the trick

if (overflow !== null) {
 buffer = Buffer.concat([overflow, buffer]);
}

3 chunk log
read 65536
read + overflow 65536
record 93
overflow 86
read 65536
read + overflow 65622
record 93
overflow 57
read 65536
read + overflow 65593

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions