web-csv-toolbox
    Preparing search index...

    Interface BinaryOptions

    CSV Parsing Options for binary.

    interface BinaryOptions {
        allowExperimentalCompressions?: boolean;
        charset?: string;
        decompression?: CompressionFormat;
        fatal?: boolean;
        ignoreBOM?: boolean;
        maxBinarySize?: number;
    }

    Hierarchy (View Summary)

    Index

    Properties

    allowExperimentalCompressions?: boolean

    Allow experimental or non-standard compression formats not explicitly supported by this library.

    When true, compression formats from Content-Encoding headers that are not in the default supported list will be passed to the runtime's DecompressionStream without validation. This allows using compression formats that may not be universally supported across all browsers.

    When false (default), only universally supported formats are allowed:

    • Node.js: gzip, deflate, br (Brotli)
    • Browsers: gzip, deflate

    Some compression formats are only supported in specific environments:

    • deflate-raw: Supported in Chromium-based browsers (Chrome, Edge) but may not work in Firefox or Safari
    • br (Brotli): Future browser support may vary
    • Other formats: Depends on runtime implementation

    If you enable this option and use deflate-raw:

    • ✅ Works in Chrome, Edge (Chromium-based)
    • ❌ May fail in Firefox, Safari
    • Consider implementing fallback logic or detecting browser support at runtime

    Use with caution: Enabling this bypasses library validation and relies entirely on runtime error handling. If the runtime doesn't support the format, you'll get a runtime error instead of a clear validation error from this library.

    false
    
    // Safe mode (default): Only universally supported formats
    const response = await fetch('data.csv.gz');
    await parse(response); // ✓ Works in all browsers

    // Experimental mode: Allow deflate-raw (Chromium-only)
    const response = await fetch('data.csv'); // Content-Encoding: deflate-raw
    await parse(response, { allowExperimentalCompressions: true });
    // ✓ Works in Chrome/Edge
    // ✗ May fail in Firefox/Safari

    // Browser-aware usage
    const isChromium = navigator.userAgent.includes('Chrome');
    await parse(response, {
    allowExperimentalCompressions: isChromium
    });
    charset?: string

    You can specify the character encoding of the binary.

    TextDecoderStream is used internally.

    See Encoding API Compatibility for the encoding formats that can be specified.

    'utf-8'
    
    decompression?: CompressionFormat

    If the binary is compressed by a compression algorithm, the decompressed CSV can be parsed by specifying the algorithm.

    Make sure the runtime you are running supports stream decompression.

    See DecompressionStream Compatibility.

    fatal?: boolean

    If the binary has a invalid character, you can specify whether to throw an error.

    If the property is true then a decoder will throw a TypeError if it encounters malformed data while decoding.

    If false the decoder will substitute the invalid data with the replacement character U+FFFD (�).

    See TextDecoderOptions.fatal for more information.

    false
    
    ignoreBOM?: boolean

    If the binary has a BOM, you can specify whether to ignore it.

    If you specify true, the BOM will be ignored. If you specify false or not specify it, the BOM will be treated as a normal character. See TextDecoderOptions.ignoreBOM for more information about the BOM.

    false
    
    maxBinarySize?: number

    Maximum binary size in bytes for ArrayBuffer/Uint8Array inputs.

    This option limits the size of ArrayBuffer or Uint8Array inputs to prevent memory exhaustion attacks. When the binary size exceeds this limit, a RangeError will be thrown.

    Set to Number.POSITIVE_INFINITY to disable the limit (not recommended for untrusted input).

    100 * 1024 * 1024 (100MB)