zip-stream
a streaming zip archive generator.
npm downloads npm version npm license
zip-stream유사 패키지:
npm 다운로드 트렌드
3 년
🌟 zip-stream의 README.md에 실시간 사용 차트를 표시하려면 아래 코드를 복사하세요.
## Usage Trend
[![Usage Trend of zip-stream](https://npm-compare.com/img/npm-trend/THREE_YEARS/zip-stream.png)](https://npm-compare.com/zip-stream#timeRange=THREE_YEARS)
Cumulative GitHub Star Trend
🌟 zip-stream의 README.md에 GitHub Stars 트렌드 차트를 표시하려면 아래 코드를 복사하세요.
## GitHub Stars Trend
[![GitHub Stars Trend of zip-stream](https://npm-compare.com/img/github-trend/zip-stream.png)](https://npm-compare.com/zip-stream)
통계 세부사항
패키지
다운로드
Stars
크기
Issues
발행일
라이선스
zip-stream13,718,7381649.33 kB261年前MIT
zip-stream의 README

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.

import { ZipStream } from "zip-stream":
const archive = new ZipStream(); // OR new ZipStream(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.