#1103·PapaParse

parse stream will emit an error when newline is \r\n and the chunk data end with \r.

Author: acrazingCreated Aug 12, 2025Updated Aug 12, 2025

Code snippet:

typescript

import { Readable } from 'node:stream';
import Papa from 'papaparse';

const stream = new Readable({
  objectMode: true,
  read() {},
});

Papa.parse(stream, {
  delimiter: ',',
  newline: '\r\n',
  skipEmptyLines: true,
  header: true,
  complete(results, file) {
    console.log(results.errors);
  },
});

stream.push('name,value\r\n');
stream.push('foo,"FOO"\r');
stream.push('\n');
stream.push(null);

Got:

typescript
[
  {
    type: 'Quotes',
    code: 'InvalidQuotes',
    message: 'Trailing quote on quoted field is malformed',
    row: 0,
    index: 5
  }
]