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

    Interface HttpOptions

    Represents the options passed to the constructor of HttpReader.

    interface HttpOptions {
        checkResourceChanges?: boolean;
        combineSizeEocd?: boolean;
        forceRangeRequests?: boolean;
        headers?: Iterable<[string, string], any, any> | Map<string, string>;
        maximumRangeSize?: number;
        preventHeadRequest?: boolean;
        useRangeHeader?: boolean;
        useXHR?: boolean;
        fetch?(input: string, init?: RequestInit): Promise<Response>;
    }

    Hierarchy (View Summary)

    Index
    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
    
    combineSizeEocd?: boolean

    true to read the end of the archive with the same request that gives its size, and to serve the later reads landing in that range from the response instead of requesting them again, make sure beforehand that the server supports a suffix range request.

    The request asks for the last 65,557 bytes, which is how far back the reader scans for the end of central directory record, so it fetches nothing the reader was not going to read anyway. An archive shorter than that is fetched whole, and reading it then costs a single request.

    false
    
    forceRangeRequests?: boolean

    true to always use Range headers when fetching data.

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

    The HTTP headers.

    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
    
    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.

    Leaving it unset is not the same as setting it to false when HttpOptions#useRangeHeader or HttpOptions#forceRangeRequests is set: the size is then read from a ranged GET request instead, and only an explicit false restores the HEAD request.

    false, and true when HttpOptions#useRangeHeader or HttpOptions#forceRangeRequests is set

    useRangeHeader?: boolean

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

    false
    
    useXHR?: boolean

    true to rely XMLHttpRequest instead of fetch to fetch data.

    false
    
    • 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