The file to parse
Optionaloptions: ParseBinaryOptions<Header, ",", "\"">Parsing options
Async iterable iterator of records.
If you want array of records, use parseFile.toArray function.
This function can parse CSV data from File objects (from file inputs or drag-and-drop). If the File has a type with charset parameter, it will be used for decoding.
Unlike parseBlob, this function automatically sets the file name as the error source for better error reporting (unless explicitly overridden via options).
import { parseFile } 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 parseFile(file)) {
console.log(record);
}
});
Parse CSV from a File to records.