web-csv-toolbox - v0.15.0
    Preparing search index...

    Function toStream

    • Parse CSV from a File to stream of records.

      Type Parameters

      • Header extends readonly string[]

      Parameters

      Returns ReadableStream<Record<Header[number], string>>

      Stream of records

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

      const input = document.querySelector('input[type="file"]');
      input.addEventListener('change', async (event) => {
      const file = event.target.files[0];
      await parseFile.toStream(file)
      .pipeTo(
      new WritableStream({
      write(record) {
      console.log(record);
      },
      }),
      );
      });