Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/zipjs/index.d.ts>Writer

JavaScript library to zip and unzip files supporting multi-core compression, compression streams, Zip64 and encryption.
Go to Latest
class Writer
implements Initializable, WritableWriter
import { Writer } from "https://deno.land/x/zipjs@v2.6.55/index.d.ts";

Represents an instance used to write unknown type of data.

Examples

Here is an example of custom Writer class used to write binary strings:

class BinaryStringWriter extends Writer {

  constructor() {
    super();
    this.binaryString = "";
  }

  writeUint8Array(array) {
    for (let indexCharacter = 0; indexCharacter < array.length; indexCharacter++) {
      this.binaryString += String.fromCharCode(array[indexCharacter]);
    }
  }

  getData() {
    return this.binaryString;
  }
}

Properties

writable: WritableStream

The WritableStream instance.

Methods

getData(): Promise<Type>

Retrieves all the written data

optional
init(size?: number): Promise<void>

Initializes the instance asynchronously

writeUint8Array(array: Uint8Array): Promise<void>

Appends a chunk of data