Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upes.merge broke my data #93
Comments
This comment has been minimized.
This comment has been minimized.
|
merge doesn't know where the lines in your flies are. when fs reads from the disk, it may break them up anywhere. you need the splits to be at the lines so that es.parse can handle them. this should work: es.merge(fileNames.map(function(item, index) {
return fs.createReadStream(item)
.pipe(es.split())
.pipe(es.parse())
})) |
This comment has been minimized.
This comment has been minimized.
ghost
commented
Jan 19, 2016
|
Thank you @dominictarr, you are right! I need to learn about how stream works. |
ghost
closed this
Jan 19, 2016
This issue was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ghost commentedJan 14, 2016
I have 12 files to handle, so I want to create 12 ReadStreams and merge to one.
In each file, each line is a JSON string.
My code is like this:
After run it, I got some JSON.parse error like this:
and I found the error json looks like this:
I grep 1452700832306 and 1452700810077, and find they come from two different files:
in file1, test1.log:
in file2, test2.log:
So it looks like some of my data has been broken.
Node version: v4.2.3
OS: CentOS Linux release 7.0.1406 (Core)