PapaParse icon indicating copy to clipboard operation
PapaParse copied to clipboard

Example code for "Papa Parse for Node" section

Open btakita opened this issue 5 years ago • 1 comments

I'm not correctly following the verbiage of what needs to be done. Could you add a code section with a simple example?

const stream = require('stream')
const { promisify } = require('util')
const finished = promisify(stream.finished)
async function parse(rs) {
	const a1__contact = []
	const rs__papaparse = Papa.parse(Papa.NODE_STREAM_INPUT, { header: true })
	rs.pipe(rs__papaparse)
	rs__papaparse.on('data', row => a1__contact.push(row))
	await finished(rs__papaparse)
}

https://github.com/mholt/PapaParse#papa-parse-for-node

btakita avatar May 22 '19 19:05 btakita

Also this synchronous form works in Node:

const Papa = require('papaparse');

let parsedItems = Papa.parse(csvString);

console.log(parsedItems)

vini-brito avatar Feb 09 '22 00:02 vini-brito