CSV string stream to parse
Optional
options: ParseOptions<Header>Parsing options.
Async iterable iterator of records.
If you want array of records, use parseStringStream.toArray function.
import { parseStringStream } from 'web-csv-toolbox';
const csv = `name,age
Alice,42
Bob,69`;
const stream = new ReadableStream({
start(controller) {
controller.enqueue(csv);
controller.close();
},
});
for await (const record of parseStringStream(csv)) {
console.log(record);
}
// Prints:
// { name: 'Alice', age: '42' }
// { name: 'Bob', age: '69' }
Parse CSV string stream to records.