Async iterable iterator of records.
If you want array of records, use parseBlob.toArray function.
This function can parse CSV data from Blob or File objects. If the Blob has a type with charset parameter, it will be used for decoding.
File objects (from file inputs or drag-and-drop) extend Blob and are automatically supported.
import { parseBlob } from 'web-csv-toolbox';
const blob = new Blob(['name,age\nAlice,42\nBob,69'], { type: 'text/csv' });
for await (const record of parseBlob(blob)) {
console.log(record);
}
import { parseBlob } from 'web-csv-toolbox';
const input = document.querySelector('input[type="file"]');
input.addEventListener('change', async (event) => {
const file = event.target.files[0];
for await (const record of parseBlob(file)) {
console.log(record);
}
});
Parse CSV from a Blob or File to records.