web-csv-toolbox
    Preparing search index...

    Function parseResponse

    • Parse HTTP Response what contains CSV to records, ideal for smaller data sets.

      Type Parameters

      • Header extends readonly string[]

      Parameters

      Returns AsyncIterableIterator<CSVRecord<Header>>

      Async iterable iterator of records.

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

      This function automatically treats response headers.

      • If Content-Type header is not set, it assumes text/csv.
      • If Content-Type header is not text/csv, it throws an error.
      • If Content-Type header has charset parameter, it uses it for decoding.
      • If Content-Encoding header is set, it decompresses the response.
      • Should there be any conflicting information between the header and the options, the option's value will take precedence.
      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);
      }