On this page

    M

    zlib.createZipArchiveSync

    History
    zlib.createZipArchiveSync(entries, options?): Iterator
    Stability: 1.0Early development

    The ZIP archive API is experimental. Using any part of it (this function among them) emits an experimental warning the first time; merely importing node:zlib does not.

    Attributes
    entries:Iterable
    Returns:Iterator
    of Buffer chunks making up the serialized archive.

    The synchronous version of zlib.createZipArchive(). Blocks the Node.js event loop and further JavaScript execution until the whole archive (including any deflate passes) has been produced; use only where synchronous execution is appropriate (for example, short-lived scripts or startup code), not in code that must stay responsive. entries must be a plain (synchronous) Iterable - a streaming entry created with zlib.ZipEntry.createStream() throws when its turn to serialize comes up, since draining its asynchronous source has no synchronous equivalent.

    As with zlib.createZipArchive(), the entries are owned by the returned iterator and must not be reused. If iteration stops early - including the throw on a streaming entry - the entry that stopped it and every entry still queued behind it are disposed, releasing any sources they hold.