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

    Class ZipReaderStream<T>

    Represents an instance used to create an unzipped stream.

    The input is entirely read into a Blob before the first entry is emitted, because a zip file stores its central directory at the end. This class is a convenience wrapper around ZipReader for stream sources, it does not extract entries while the data is still arriving.

    This example will take a zip file, decompress it and then save its files and directories to disk.

    import {resolve} from "https://deno.land/std/path/mod.ts";
    import {ensureDir, ensureFile} from "https://deno.land/std/fs/mod.ts";

    for await (const entry of (await fetch(urlToZippedFile)).body.pipeThrough(new ZipReaderStream())) {
    const fullPath = resolve(destination, entry.filename);
    if (entry.directory) {
    await ensureDir(fullPath);
    continue;
    }

    await ensureFile(fullPath);
    await entry.readable?.pipeTo((await Deno.create(fullPath)).writable);
    }

    Type Parameters

    • T
    Index
    readable: ReadableStream<
        Omit<Entry, "getData"> & {
            readable?: ReadableStream<Uint8Array<ArrayBufferLike>>;
        },
    >

    The readable stream.

    The properties deposited on an entry while its data is read, i.e. EntryMetaData#warnings and EntryMetaData#localDirectory, are shared with the chunk, so they are readable on it once its readable property has been consumed.

    An entry is decompressed on demand, when its readable property starts being read, so a chunk whose data is never read costs nothing and skipping entries is free. Cancelling this stream releases the entry being read, cancels the source and closes the underlying ZipReader.

    writable: WritableStream<T>

    The writable stream.