Function parseString

  • Parse CSV string to records.

    Type Parameters

    • Header extends readonly string[]

    Parameters

    Returns AsyncIterableIterator<CSVRecord<Header>>

    Async iterable iterator of records.

    If you want array of records, use parseString.toArray function.

    Example: Parsing CSV files from strings

    import { parseString } from 'web-csv-toolbox';

    const csv = `name,age
    Alice,42
    Bob,69`;

    for await (const record of parseString(csv)) {
    console.log(record);
    }
    // Prints:
    // { name: 'Alice', age: '42' }
    // { name: 'Bob', age: '69' }