@zip.js/zip.js
    Preparing search index...

    Interface ZipDirectoryEntryImportHttpOptions

    Represents the options passed to ZipDirectoryEntry#importHttpContent.

    interface ZipDirectoryEntryImportHttpOptions {
        checkAmbiguity?: boolean;
        checkOverlappingEntry?: boolean;
        checkOverlappingEntryOnly?: boolean;
        checkPasswordOnly?: boolean;
        checkResourceChanges?: boolean;
        checkSignature?: boolean;
        combineSizeEocd?: boolean;
        commentEncoding?: string;
        extractAppendedData?: boolean;
        extractPrependedData?: boolean;
        filenameEncoding?: string;
        forceRangeRequests?: boolean;
        headers?: Iterable<[string, string], any, any> | Map<string, string>;
        maxAppendedDataSize?: number;
        maximumRangeSize?: number;
        passThrough?: boolean;
        password?: string;
        preventClose?: boolean;
        preventHeadRequest?: boolean;
        rawPassword?: Uint8Array<ArrayBufferLike>;
        signal?: AbortSignal;
        strictness?: "balanced" | "strict" | "tolerant";
        transferStreams?: boolean;
        useCompressionStream?: boolean;
        useRangeHeader?: boolean;
        useWebWorkers?: boolean;
        useXHR?: boolean;
        decodeText?(value: Uint8Array, encoding: string): string | undefined;
        fetch?(input: string, init?: RequestInit): Promise<Response>;
    }

    Hierarchy (View Summary)

    Index
    checkAmbiguity?: boolean

    true to throw an ERR_AMBIGUOUS_ARCHIVE error when calling FileEntry#getData if the local file header of the entry disagrees with its central directory record in a way that could make other tools (e.g. streaming readers based on local file headers) interpret the entry differently. This detects mismatched filenames, general purpose bit flags (encryption, data descriptor and language encoding flags), compression methods, signatures and sizes. The extra fields are not compared because the zip specification allows them to differ.

    false
    
    checkOverlappingEntry?: boolean

    true to throw an ERR_OVERLAPPING_ENTRY error when calling FileEntry#getData if the entry overlaps with another entry on which FileEntry#getData has already been called (with the option checkOverlappingEntry or checkOverlappingEntryOnly set to true).

    false
    
    checkOverlappingEntryOnly?: boolean

    true to throw an ERR_OVERLAPPING_ENTRY error when calling FileEntry#getData if the entry overlaps with another entry on which FileEntry#getData has already been called (with the option checkOverlappingEntry or checkOverlappingEntryOnly set to true) without trying to read the content of the entry.

    false
    
    checkPasswordOnly?: boolean

    true to check only if the password is valid.

    false
    
    checkResourceChanges?: boolean

    true to throw an ERR_HTTP_RESOURCE_CHANGED error when the ETag, Last-Modified or total size headers returned by a range request differ from the ones returned by the first range request, i.e. when the resource has been modified while being read. Headers missing from the responses are ignored, note that Access-Control-Expose-Headers must include them when the resource is fetched cross-origin.

    true
    
    checkSignature?: boolean

    true to check the signature of the entry.

    false
    
    combineSizeEocd?: boolean

    true to use Range: bytes=-22 on the first request and cache the EOCD, make sure beforehand that the server supports a suffix range request.

    false
    
    commentEncoding?: string

    The encoding of the comment of the entry.

    extractAppendedData?: boolean

    true to extract the appended data into ZipReader#appendedData.

    false
    
    extractPrependedData?: boolean

    true to extract the prepended data into ZipReader#prependedData.

    false
    
    filenameEncoding?: string

    The encoding of the filename of the entry.

    forceRangeRequests?: boolean

    true to always use Range headers when fetching data.

    false
    
    headers?: Iterable<[string, string], any, any> | Map<string, string>

    The HTTP headers.

    maxAppendedDataSize?: number

    The maximum number of bytes tolerated after the zip structure before the archive is rejected. Defaults to 0 when GetEntriesOptions#strictness is "strict", 65535 when it is "balanced", and Infinity when it is "tolerant".

    An explicit value takes precedence over the strictness default at every level, so it can loosen "strict" or reintroduce a rejection under "tolerant". It also bounds how far back the end of central directory record is searched for, so a value smaller than the amount of data actually appended surfaces an ERR_EOCDR_NOT_FOUND error when the record lies beyond the searched region and an ERR_AMBIGUOUS_ARCHIVE error otherwise.

    maximumRangeSize?: number

    The maximum size in bytes of the range requests sent to read the data of an entry. The data is read with as many range requests as necessary, each response body being streamed, so that the size of a request never depends on the size of the entry.

    Because response bodies are streamed with backpressure, this value does not bound how much data is buffered in memory; it bounds the byte span, and therefore the lifetime, of each individual range request. Smaller windows keep each request short-lived, which avoids the idle or duration timeouts enforced by servers, CDNs and proxies when a slow consumer holds a connection open, and avoids relying on the server honoring very large ranges. Set it to Infinity to disable windowing and read each entry with a single range request covering its whole remaining length.

    16777216
    
    passThrough?: boolean

    true to read the data as-is without decompressing it and without decrypting it.

    password?: string

    The password used to decrypt the content of the entry.

    preventClose?: boolean

    true to prevent closing of Writer#writable when calling FileEntry#getData.

    false
    
    preventHeadRequest?: boolean

    true to prevent using HEAD HTTP request in order the get the size of the content. false to explicitly use HEAD, this is useful in case of CORS where Access-Control-Expose-Headers: Content-Range is not returned by the server.

    false
    
    rawPassword?: Uint8Array<ArrayBufferLike>

    The password used to encrypt the content of the entry (raw).

    signal?: AbortSignal

    The AbortSignal instance used to cancel the decompression.

    strictness?: "balanced" | "strict" | "tolerant"

    How tolerant the reader should be when the local file header of an entry disagrees with its central directory record. "strict" throws an ERR_AMBIGUOUS_ARCHIVE error (equivalent to ZipReaderOptions#checkAmbiguity set to true); "balanced" and "tolerant" trust the central directory record.

    "balanced"
    
    transferStreams?: boolean

    true to transfer stream ownership to web workers.

    true
    
    useCompressionStream?: boolean

    true to use the native API CompressionStream/DecompressionStream to compress/decompress data.

    true
    
    useRangeHeader?: boolean

    true to use Range headers when fetching data from servers returning Accept-Ranges headers.

    false
    
    useWebWorkers?: boolean

    true to use web workers to compress/decompress data in non-blocking background processes.

    true
    
    useXHR?: boolean

    true to rely XMLHttpRequest instead of fetch to fetch data.

    false
    
    • The function called for decoding the filename and the comment of the entry.

      Parameters

      • value: Uint8Array

        The raw text value.

      • encoding: string

        The encoding of the text.

      Returns string | undefined

      The decoded text value or undefined if the raw text value should be decoded by zip.js.

    • The function used to fetch the data. It takes precedence over HttpRangeOptions#useXHR when set. The returned object must expose the status, statusText and headers properties, and the arrayBuffer() method of the Response class.

      Parameters

      • input: string
      • Optionalinit: RequestInit

      Returns Promise<Response>

      fetch