Class RemoteZip

An initialised object representating a remote ZIP archive.

Best constructed from a RemoteZipPointer.

import { RemoteZipPointer } from "remote-zip";

const url = new URL("http://www.example.com/test.zip");
const remoteZip = await new RemoteZipPointer({ url }).populate();

Hierarchy

  • RemoteZip

Constructors

  • Parameters

    • __namedParameters: {
          centralDirectoryRecords: CentralDirectoryRecord[];
          contentLength: number;
          credentials: "include" | "omit" | "same-origin";
          endOfCentralDirectory: null | EndOfCentralDirectory;
          method: string;
          url: URL;
      }
      • centralDirectoryRecords: CentralDirectoryRecord[]
      • contentLength: number

        Length of the remote ZIP archive in bytes

      • credentials: "include" | "omit" | "same-origin"

        Passed to fetch when performing a HTTP GET request for the file.

      • endOfCentralDirectory: null | EndOfCentralDirectory
      • method: string

        Passed to fetch when performing a HTTP GET request for the file

      • url: URL

        Passed to fetch when performing a HTTP GET request for the file

    Returns RemoteZip

Properties

centralDirectoryRecords: CentralDirectoryRecord[]

Records representing the files in the remote ZIP archive

contentLength: number

Size of the remote ZIP archive in bytes

credentials: "include" | "omit" | "same-origin"

Credentials passed to fetch when retrieving files. Defaults to same-origin.

endOfCentralDirectory: null | EndOfCentralDirectory

Metadata of the remote ZIP archive

method: string

HTTP method used to fetch files from the remote ZIP archive

url: URL

URL of the remote ZIP archive

Methods

  • Gets a single uncompressed file in the remote ZIP archive.

    Parameters

    • path: string

      Path of the file in the remote ZIP archive

    • Optional additionalHeaders: Headers

      Additional headers, if any, to be passed to the fetch request

    Returns Promise<ArrayBuffer>

    Inflated (uncompressed) bytes of the requested file

    Throws

    RemoteZipError if it fails to parse or fetch

  • Get a formatted file listing of the remote ZIP archive.

    Returns RemoteZipFile[]

    List of files in the remote ZIP archive.

    import { RemoteZipPointer } from "remote-zip";

    const url = new URL("http://www.example.com/test.zip");
    const remoteZip = await new RemoteZipPointer({ url }).populate();
    const files = remoteZip.files();
    // files = [{ attributes: 1107099648, filename: "text.txt", modified: "2021-06-17T12:28:02", size: 14 }]

Generated using TypeDoc