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

    Function createBinaryCSVParser

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

      Type Parameters

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

        The type of the header row

      • const Delimiter extends string = ","
      • const Quotation extends string = "\""
      • const Charset extends string = "utf-8"
      • const Strategy extends ColumnCountStrategy = ColumnCountStrategy

      Parameters

      Returns BinaryArrayCSVParser<Header>

      A parser instance configured for the specified output format

      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)

      Design Intent: This factory function accepts options including engine configuration to enable future execution path optimization. The function may select the optimal internal parser implementation based on the provided options. Currently, this optimization is not implemented, but the API is designed to support it without breaking changes.

      const parser = createBinaryCSVParser({
      header: ['name', 'age'],
      charset: 'utf-8',
      decompression: 'gzip',
      signal: abortController.signal,
      });
      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'],
      outputFormat: 'array',
      charset: 'utf-8',
      });
      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

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

        The type of the header row

      • const Delimiter extends string = ","
      • const Quotation extends string = "\""
      • const Charset extends string = "utf-8"
      • const Strategy extends ColumnCountStrategy = ColumnCountStrategy

      Parameters

      Returns BinaryObjectCSVParser<Header>

      A parser instance configured for the specified output format

      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)

      Design Intent: This factory function accepts options including engine configuration to enable future execution path optimization. The function may select the optimal internal parser implementation based on the provided options. Currently, this optimization is not implemented, but the API is designed to support it without breaking changes.

      const parser = createBinaryCSVParser({
      header: ['name', 'age'],
      charset: 'utf-8',
      decompression: 'gzip',
      signal: abortController.signal,
      });
      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'],
      outputFormat: 'array',
      charset: 'utf-8',
      });
      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

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

        The type of the header row

      • const Delimiter extends string = ","
      • const Quotation extends string = "\""
      • const Charset extends string = "utf-8"
      • const Strategy extends ColumnCountStrategy = ColumnCountStrategy

      Parameters

      Returns BinaryObjectCSVParser<Header>

      A parser instance configured for the specified output format

      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)

      Design Intent: This factory function accepts options including engine configuration to enable future execution path optimization. The function may select the optimal internal parser implementation based on the provided options. Currently, this optimization is not implemented, but the API is designed to support it without breaking changes.

      const parser = createBinaryCSVParser({
      header: ['name', 'age'],
      charset: 'utf-8',
      decompression: 'gzip',
      signal: abortController.signal,
      });
      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'],
      outputFormat: 'array',
      charset: 'utf-8',
      });
      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

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

        The type of the header row

      • const Delimiter extends string = ","
      • const Quotation extends string = "\""
      • const Charset extends string = "utf-8"
      • const OutputFormat extends "object" | "array" = "object" | "array"
      • const Strategy extends ColumnCountStrategy = ColumnCountStrategy

      Parameters

      Returns BinaryArrayCSVParser<Header> | BinaryObjectCSVParser<Header>

      A parser instance configured for the specified output format

      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)

      Design Intent: This factory function accepts options including engine configuration to enable future execution path optimization. The function may select the optimal internal parser implementation based on the provided options. Currently, this optimization is not implemented, but the API is designed to support it without breaking changes.

      const parser = createBinaryCSVParser({
      header: ['name', 'age'],
      charset: 'utf-8',
      decompression: 'gzip',
      signal: abortController.signal,
      });
      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'],
      outputFormat: 'array',
      charset: 'utf-8',
      });
      const encoder = new TextEncoder();
      for (const record of parser.parse(encoder.encode('Alice,30\nBob,25'))) {
      console.log(record); // ['Alice', '30']
      }