PapaParse
PapaParse copied to clipboard
Example code for "Papa Parse for Node" section
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
Also this synchronous form works in Node:
const Papa = require('papaparse');
let parsedItems = Papa.parse(csvString);
console.log(parsedItems)