Optional
options: ParseOptions<Header>Async iterable iterator of records.
If you want array of records, use parseResponse.toArray function.
This function automatically treats response headers.
Content-Type
header is not set, it assumes text/csv
.Content-Type
header is not text/csv
, it throws an error.Content-Type
header has charset parameter, it uses it for decoding.Content-Encoding
header is set, it decompresses the response.import { parseResponse } from 'web-csv-toolbox';
const response = await fetch('https://example.com/data.csv');
for await (const record of parseResponse(response)) {
console.log(record);
}
Parse HTTP Response what contains CSV to records, ideal for smaller data sets.