web-csv-toolbox
    Preparing search index...

    Interface RecordAssemblerOptions<Header>

    Record Assembler Options for CSV.

    If you specify header: ['foo', 'bar'], the first record will be treated as a normal record.

    If you don't specify header, the first record will be treated as a header.

    interface RecordAssemblerOptions<Header extends ReadonlyArray<string>> {
        header?: Header;
        signal?: AbortSignal;
    }

    Type Parameters

    • Header extends ReadonlyArray<string>

    Hierarchy (View Summary)

    Index

    Properties

    Properties

    header?: Header

    CSV header.

    If you specify this option, the first record will be treated as a normal record.

    If you don't specify this option, the first record will be treated as a header.

    undefined
    
    signal?: AbortSignal

    The signal to abort the operation.

    If the signal is aborted, the operation will be stopped.

    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();
    });
    const csv = "foo,bar\n1,2\n3,4";

    try {
    const result = await parse(csv, { signal: AbortSignal.timeout(1000) });
    } catch (e) {
    if (e instanceof DOMException && e.name === "TimeoutError") {
    console.log("Timeout");
    }
    }
    undefined