OptionaldelimiterCSV field delimiter.
If you want to parse TSV, specify '\t'.
OptionalengineEngine configuration for CSV parsing.
OptionalheaderCSV header.
OptionalmaxMaximum internal buffer size in characters.
This option limits the size of the internal buffer used during lexing
to prevent memory exhaustion attacks. The buffer size is measured in
UTF-16 code units (JavaScript string length). When the buffer exceeds
this limit, a RangeError will be thrown.
Set to Infinity to disable the limit (not recommended for untrusted input).
OptionalmaxMaximum number of fields allowed per record.
OptionalquotationCSV field quotation.
OptionalsignalThe signal to abort the operation.
const controller = new AbortController();
const csv = "foo,bar\n1,2\n3,4";
try {
const result = await parse(csv, { signal: controller.signal });
} catch (e) {
if (e instanceof DOMException && e.name === "AbortError") {
console.log("Aborted");
}
}
// Abort with user action
document.getElementById("cancel-button")
.addEventListener("click", () => {
controller.abort();
});
OptionalskipWhen true, completely empty lines (with only delimiters or whitespace) will be skipped during parsing.
Parse options for CSV string.