zip-stream

WebJar for zip-stream

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

zip-stream
Last Version

Last Version

3.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

zip-stream
WebJar for zip-stream
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/archiverjs/node-zip-stream

Download zip-stream

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/zip-stream/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>zip-stream</artifactId>
    <version>3.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/zip-stream/
implementation 'org.webjars.npm:zip-stream:3.0.1'
// https://jarcasting.com/artifacts/org.webjars.npm/zip-stream/
implementation ("org.webjars.npm:zip-stream:3.0.1")
'org.webjars.npm:zip-stream:jar:3.0.1'
<dependency org="org.webjars.npm" name="zip-stream" rev="3.0.1">
  <artifact name="zip-stream" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='zip-stream', version='3.0.1')
)
libraryDependencies += "org.webjars.npm" % "zip-stream" % "3.0.1"
[org.webjars.npm/zip-stream "3.0.1"]

Dependencies

compile (3)

Group / Artifact Type Version
org.webjars.npm : archiver-utils jar [2.1.0,3)
org.webjars.npm : compress-commons jar [3.0.0,4)
org.webjars.npm : readable-stream jar [3.6.0,4)

Project Modules

There are no modules declared in this project.

ZipStream

zip-stream is a streaming zip archive generator based on the ZipArchiveOutputStream prototype found in the compress-commons project.

It was originally created to be a successor to zipstream.

Visit the API documentation for a list of all methods available.

Install

npm install zip-stream --save

You can also use npm install https://github.com/archiverjs/node-zip-stream/archive/master.tar.gz to test upcoming versions.

Usage

This module is meant to be wrapped internally by other modules and therefore lacks any queue management. This means you have to wait until the previous entry has been fully consumed to add another. Nested callbacks should be used to add multiple entries. There are modules like async that ease the so called "callback hell".

If you want a module that handles entry queueing and much more, you should check out archiver which uses this module internally.

const Packer = require('zip-stream');
const archive = new Packer(); // OR new Packer(options)

archive.on('error', function(err) {
  throw err;
});

// pipe archive where you want it (ie fs, http, etc)
// listen to the destination's end, close, or finish event

archive.entry('string contents', { name: 'string.txt' }, function(err, entry) {
  if (err) throw err;
  archive.entry(null, { name: 'directory/' }, function(err, entry) {
    if (err) throw err;
    archive.finish();
  });
});

Credits

Concept inspired by Antoine van Wel's zipstream module, which is no longer being updated.

org.webjars.npm

Archiver

Versions

Version
3.0.1
2.1.3
1.2.0
0.5.2