Module

x/zipjs/index.js>ZipReaderStream

JavaScript library to zip and unzip files supporting multi-core compression, compression streams, zip64, split files and encryption.
Latest
class ZipReaderStream
import { ZipReaderStream } from "https://dotland.deno.dev/x/zipjs@v2.7.53/index.js";

Represents an instance used to create an unzipped stream.

Examples

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);
}

Constructors

new
ZipReaderStream(options?: ZipReaderConstructorOptions)

Creates the stream.

Properties

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

The readable stream.

writable: WritableStream<T>

The writable stream.