Use Papa Parse in Node.js with Readable Streams
masterIn Node.js environments, Papa Parse can parse Readable Streams in addition to strings.
Important Constraints:
- If using a stream, the
encodingoption must be a Node-supported character encoding. - The following options are unavailable when parsing a stream:
Papa.LocalChunkSize,Papa.RemoteChunkSize,download,withCredentials, andworker.
Node.js Streaming Style (.pipe):
To use Node's .pipe() method, pipe your Readable Stream to the stream returned by Papa.parse(Papa.NODE_STREAM_INPUT, options).
When using this streaming mode:
- The following options are unavailable:
Papa.LocalChunkSize,Papa.RemoteChunkSize,download,withCredentials,worker,step, andcomplete. - Use the
'data'event to process chunks:stream.on('data', callback). - Use the
'end'event to signal the end of the stream:stream.on('end', callback).