web-csv-toolbox
    Preparing search index...

    Function toArray

    • Parse CSV string to array of records, ideal for smaller data sets.

      Type Parameters

      • Header extends readonly string[]

      Parameters

      Returns Promise<CSVRecord<Header>[]>

      Performance Characteristics:

      • Memory usage: O(n) - proportional to file size (loads entire result into memory)
      • Suitable for: Small datasets, quick prototyping
      • Recommended max: ~10MB (browser), ~100MB (Node.js/Deno)

      This function collects all records into an array before returning. For large files, consider using the streaming parse function instead.

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

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

      const records = await parse.toArray(csv);
      console.log(records);
      // Prints:
      // [ { name: 'Alice', age: '42' }, { name: 'Bob', age: '69' } ]
    • Parse CSV binary to array of records, ideal for smaller data sets.

      Type Parameters

      • Header extends readonly string[]

      Parameters

      Returns Promise<CSVRecord<Header>[]>

      Performance Characteristics:

      • Memory usage: O(n) - proportional to file size (loads entire result into memory)
      • Suitable for: Small datasets, quick prototyping
      • Recommended max: ~10MB (browser), ~100MB (Node.js/Deno)

      This function collects all records into an array before returning. For large files, consider using the streaming parse function instead.

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

      const response = await fetch('https://example.com/data.csv');

      const records = await parse.toArray(response);
      console.log(records);