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

    Function createBinaryCSVParser

    • Factory function to create the appropriate Binary CSV parser based on options.

      Type Parameters

      • Header extends readonly string[] = readonly string[]

        The type of the header row

      Parameters

      Returns BinaryArrayCSVParser<Header>

      A parser instance configured for the specified output format

      This is a low-level factory function that accepts BinaryCSVProcessingOptions. It does NOT accept execution strategy options (engine). For high-level APIs with execution strategy support, use parseBinary() and related functions.

      This function provides both compile-time and runtime type safety. The return type is determined by the outputFormat option:

      • outputFormat: 'object' (default) → BinaryObjectCSVParser (FlexibleBinaryObjectCSVParser)
      • outputFormat: 'array' → BinaryArrayCSVParser (FlexibleBinaryArrayCSVParser)
      const parser = createBinaryCSVParser({
      header: ['name', 'age'] as const,
      charset: 'utf-8',
      decompression: 'gzip',
      signal: abortController.signal,
      // engine is NOT available (low-level API)
      });
      const encoder = new TextEncoder();
      for (const record of parser.parse(encoder.encode('Alice,30\nBob,25'))) {
      console.log(record); // { name: 'Alice', age: '30' }
      }
      const parser = createBinaryCSVParser({
      header: ['name', 'age'] as const,
      outputFormat: 'array',
      charset: 'utf-8',
      // engine is NOT available (low-level API)
      });
      const encoder = new TextEncoder();
      for (const record of parser.parse(encoder.encode('Alice,30\nBob,25'))) {
      console.log(record); // ['Alice', '30']
      }
    • Factory function to create the appropriate Binary CSV parser based on options.

      Type Parameters

      • Header extends readonly string[] = readonly string[]

        The type of the header row

      Parameters

      Returns BinaryObjectCSVParser<Header>

      A parser instance configured for the specified output format

      This is a low-level factory function that accepts BinaryCSVProcessingOptions. It does NOT accept execution strategy options (engine). For high-level APIs with execution strategy support, use parseBinary() and related functions.

      This function provides both compile-time and runtime type safety. The return type is determined by the outputFormat option:

      • outputFormat: 'object' (default) → BinaryObjectCSVParser (FlexibleBinaryObjectCSVParser)
      • outputFormat: 'array' → BinaryArrayCSVParser (FlexibleBinaryArrayCSVParser)
      const parser = createBinaryCSVParser({
      header: ['name', 'age'] as const,
      charset: 'utf-8',
      decompression: 'gzip',
      signal: abortController.signal,
      // engine is NOT available (low-level API)
      });
      const encoder = new TextEncoder();
      for (const record of parser.parse(encoder.encode('Alice,30\nBob,25'))) {
      console.log(record); // { name: 'Alice', age: '30' }
      }
      const parser = createBinaryCSVParser({
      header: ['name', 'age'] as const,
      outputFormat: 'array',
      charset: 'utf-8',
      // engine is NOT available (low-level API)
      });
      const encoder = new TextEncoder();
      for (const record of parser.parse(encoder.encode('Alice,30\nBob,25'))) {
      console.log(record); // ['Alice', '30']
      }
    • Factory function to create the appropriate Binary CSV parser based on options.

      Type Parameters

      • Header extends readonly string[] = readonly string[]

        The type of the header row

      Parameters

      • options: Omit<BinaryCSVProcessingOptions<Header, ",", "\"">, "outputFormat"> & {
            outputFormat: "object" | "array";
        }

        Binary CSV processing specification (excludes execution strategy)

      Returns BinaryArrayCSVParser<Header> | BinaryObjectCSVParser<Header>

      A parser instance configured for the specified output format

      This is a low-level factory function that accepts BinaryCSVProcessingOptions. It does NOT accept execution strategy options (engine). For high-level APIs with execution strategy support, use parseBinary() and related functions.

      This function provides both compile-time and runtime type safety. The return type is determined by the outputFormat option:

      • outputFormat: 'object' (default) → BinaryObjectCSVParser (FlexibleBinaryObjectCSVParser)
      • outputFormat: 'array' → BinaryArrayCSVParser (FlexibleBinaryArrayCSVParser)
      const parser = createBinaryCSVParser({
      header: ['name', 'age'] as const,
      charset: 'utf-8',
      decompression: 'gzip',
      signal: abortController.signal,
      // engine is NOT available (low-level API)
      });
      const encoder = new TextEncoder();
      for (const record of parser.parse(encoder.encode('Alice,30\nBob,25'))) {
      console.log(record); // { name: 'Alice', age: '30' }
      }
      const parser = createBinaryCSVParser({
      header: ['name', 'age'] as const,
      outputFormat: 'array',
      charset: 'utf-8',
      // engine is NOT available (low-level API)
      });
      const encoder = new TextEncoder();
      for (const record of parser.parse(encoder.encode('Alice,30\nBob,25'))) {
      console.log(record); // ['Alice', '30']
      }
    • Factory function to create the appropriate Binary CSV parser based on options.

      Type Parameters

      • Header extends readonly string[] = readonly string[]

        The type of the header row

      Parameters

      Returns BinaryObjectCSVParser<Header>

      A parser instance configured for the specified output format

      This is a low-level factory function that accepts BinaryCSVProcessingOptions. It does NOT accept execution strategy options (engine). For high-level APIs with execution strategy support, use parseBinary() and related functions.

      This function provides both compile-time and runtime type safety. The return type is determined by the outputFormat option:

      • outputFormat: 'object' (default) → BinaryObjectCSVParser (FlexibleBinaryObjectCSVParser)
      • outputFormat: 'array' → BinaryArrayCSVParser (FlexibleBinaryArrayCSVParser)
      const parser = createBinaryCSVParser({
      header: ['name', 'age'] as const,
      charset: 'utf-8',
      decompression: 'gzip',
      signal: abortController.signal,
      // engine is NOT available (low-level API)
      });
      const encoder = new TextEncoder();
      for (const record of parser.parse(encoder.encode('Alice,30\nBob,25'))) {
      console.log(record); // { name: 'Alice', age: '30' }
      }
      const parser = createBinaryCSVParser({
      header: ['name', 'age'] as const,
      outputFormat: 'array',
      charset: 'utf-8',
      // engine is NOT available (low-level API)
      });
      const encoder = new TextEncoder();
      for (const record of parser.parse(encoder.encode('Alice,30\nBob,25'))) {
      console.log(record); // ['Alice', '30']
      }