Closed C-Ezra-M closed 1 year ago
Describe the bug
The last line is always skipped. CSV 6.3.1 is used in this example, which uses csv-parse 5.4.0.
To Reproduce
function getParser() { let parser = csv.parse() parser.on('readable', () => { let rec while ((rec = parser.read()) !== null) { console.log(rec) } }) return parser } let src = `color,hex,user,score,gold,silver,bronze,status Teal,#009c9c,Alec,46581,3,2,3,S Navy,#000084,Laser,44037,0,6,2,S Forest,#002c00,Rice Field,40797,1,1,1,S Yellow,#ffff00,Keyacom,38171,2,0,2,S ` getParser().write(src) getParser().write(src + "\n")
To parse all records successfully without introducing a dummy record, at least two trailing newlines are required.
The getParser().write(src) will parse the first 4 lines. The getParser().write(src + "\n") will parse all 5 lines.
getParser().write(src)
getParser().write(src + "\n")
Additional context
This happens regardless of the columns or skip_empty_lines option.
columns
skip_empty_lines
You open a stream writer, write into it but you don't close it.
Yeah, I forgot.
Describe the bug
The last line is always skipped. CSV 6.3.1 is used in this example, which uses csv-parse 5.4.0.
To Reproduce
To parse all records successfully without introducing a dummy record, at least two trailing newlines are required.
The
getParser().write(src)
will parse the first 4 lines. ThegetParser().write(src + "\n")
will parse all 5 lines.Additional context
This happens regardless of the
columns
orskip_empty_lines
option.