tar
    Preparing search index...

    Type Alias Codec

    One compression format. Pass codecs in the codecs option to add a format, or to replace the gzip support of the runtime.

    The readers use the first codec for which detect returns true. If there is none, and the archive has a file name, and the input does not start with a tar header, they use the first codec that has an ending of the file name in extensions.

    The readers enforce maxDecompressionRatio for each codec.

    type Codec = {
        extensions?: string[];
        headLength: number;
        name: string;
        compress?(options?: Record<string, unknown>): CodecStream;
        compressSync?(
            data: Uint8Array,
            options?: Record<string, unknown>,
        ): Uint8Array;
        decompress(): CodecStream;
        decompressSync?(
            data: Uint8Array,
            limit: { maxOutputLength: number },
        ): Uint8Array;
        detect(head: Uint8Array): boolean;
    }
    Index

    Properties

    extensions?: string[]

    File name endings, such as .tar.br, for a format that detect cannot identify.

    headLength: number

    The number of bytes that detect needs.

    name: string

    Methods

    • Compress all of data.

      Parameters

      • data: Uint8Array
      • Optionaloptions: Record<string, unknown>

      Returns Uint8Array

    • Decompress all of data. The sync readers need it. It must throw before it makes more than limit.maxOutputLength bytes. That number is Infinity when the caller sets no ratio limit.

      Parameters

      • data: Uint8Array
      • limit: { maxOutputLength: number }

      Returns Uint8Array

    • True if the input is in this format. head is the start of the input: headLength bytes or more, or all of a shorter input.

      Parameters

      • head: Uint8Array

      Returns boolean