Length of the remote ZIP archive in bytes
Passed to fetch when performing a HTTP GET request for the file.
Passed to fetch when performing a HTTP GET request for the file
Passed to fetch when performing a HTTP GET request for the file
Records representing the files in the remote ZIP archive
Size of the remote ZIP archive in bytes
Credentials passed to fetch when retrieving files. Defaults to same-origin.
Metadata of the remote ZIP archive
HTTP method used to fetch files from the remote ZIP archive
OptionalredirectRedirect mode passed to fetch. Defaults to "follow".
OptionalrequestExtra RequestInit merged into every fetch.
OptionalsignalSignal that aborts in-flight requests.
OptionaltimeoutPer-request timeout in milliseconds.
URL of the remote ZIP archive
Gets a single uncompressed file in the remote ZIP archive.
Path of the file in the remote ZIP archive
OptionaladditionalHeaders: HeadersAdditional headers, if any, to be passed to the fetch request
Optionaloptions: EntryDecodeOptionsPer-call options for RemoteZip.fetch / RemoteZip.fetchStream.
OptionalmaxUncompressedSize?: numberIf set, decompression aborts and throws once output would exceed this many bytes.
Optionalpassword?: stringPassword for an encrypted entry (traditional ZipCrypto or WinZip AES).
Optionalsignal?: AbortSignalAborts this request (in addition to any instance-level signal).
OptionaltimeoutMs?: numberPer-request timeout in milliseconds.
OptionalverifyCrc?: booleanIf set, verify the decompressed output against the entry's CRC-32.
Inflated (uncompressed) bytes of the requested file
RemoteZipError if it fails to parse, fetch, or exceeds limits
Like fetch, but returns a ReadableStream of the uncompressed bytes
so large entries can be processed incrementally without buffering the whole
file. maxUncompressedSize is enforced mid-stream (the stream errors with a
RemoteZipError once exceeded).
const stream = await remoteZip.fetchStream("big.bin");
for await (const chunk of stream) {
// process each chunk
}
OptionaladditionalHeaders: HeadersOptionaloptions: EntryDecodeOptionsGet a formatted file listing of the remote ZIP archive.
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 }]
An initialised object representating a remote ZIP archive.
Best constructed from a
RemoteZipPointer.