Documentation
    Preparing search index...

    Builds a zip file, one entry at a time, on a worker thread.

    finish completes the archive and shuts the worker down; the builder cannot be used afterwards.

    Index

    Properties

    stream?: Readable

    set when the archive is streamed to the caller rather than to a file

    Methods

    • Add an entry from content held in memory

      Parameters

      • entryName: string
      • data: Buffer

      Returns Promise<void>

    • Add a directory entry. A trailing slash is added if missing.

      Parameters

      • entryName: string

      Returns Promise<void>

    • Add an entry from a file on disk. The worker streams it.

      Parameters

      • entryName: string
      • localPath: string

      Returns Promise<void>

    • Add an entry from a stream of content produced in the main thread, for content too large to want as one buffer - a table dump, say. Each chunk is acknowledged before the next is sent, so the producer runs no faster than the archive is written.

      Parameters

      • entryName: string
      • source: Readable

      Returns Promise<void>

    • Abandon a half-built archive and close the worker. Any consumer of stream is failed too, so a partial archive is never mistaken for a complete one.

      Parameters

      • Optionalcause: any

      Returns Promise<void>

    • Complete the archive and close the worker

      Returns Promise<void>

    • Build an archive at a path on disk. It is written where it belongs - writing it elsewhere and moving it would fail across filesystems.

      Parameters

      • path: string
      • Optionalpassword: string

        if non-empty, entries are encrypted with the traditional zip password scheme, as the system zip -P did

      Returns Promise<ZipBuilder>

    • Build an archive into a readable stream, for destinations written over the network (S3, SFTP) or straight to a browser, so that no copy is made on the local disk. Read stream while adding entries: the archive is produced as it is consumed.

      Parameters

      • Optionalpassword: string

      Returns Promise<ZipBuilder>