Interesting, so the comma appears in chunks but does not appear in data, nor in data.toString('utf8'). Thus the comma is created during the chunks.push(...) operation
The file gets split on the line before the one that ultimately receives the comma.
The comma appears in chunks between the two file halves when the second half of the file is added using chunks.push(...) for the second half.
Edit: so I assume that the console.log function probably is doing some kind of array join behind the scenes in order to output a string version of the array? Not sure if it’s a characteristic of .push or .join
I’m a little surprised that this hasn’t come up for other folks before though (or even myself, since I have had even longer files recently). So it feels like there may be some weird condition where this doesn’t happen, but regardless it seems like joining explicitly with the "" seems like the mitigation.
I’m a little surprised that this hasn’t come up for other folks
well if i understand the underlying issue, you'll only get more than one chunk when you try to preprocess a file larger than 16kb and helpfully ['x'].join(); // => 'x' so it seems most are working with smaller files.
Is that your way of kindly telling me to split my code up more?
Yeah, that makes sense in general, though I’m honestly surprised it worked as long as it did for me - the comma must have been lodged in a block comment haha.