zip-stream vs archiver vs tar vs tar-fs vs tar-stream
アーカイブおよび圧縮ライブラリ
zip-streamarchivertartar-fstar-stream類似パッケージ:

アーカイブおよび圧縮ライブラリ

アーカイブおよび圧縮ライブラリは、ファイルやディレクトリを圧縮して保存したり、アーカイブ形式でまとめたりするためのツールです。これらのライブラリは、データの転送や保存を効率的に行うために使用され、特に大規模なデータセットや複数のファイルを扱う際に便利です。これらのライブラリを使用することで、ストレージの節約やデータ転送の高速化が可能になります。

npmのダウンロードトレンド

3 年

GitHub Starsランキング

統計詳細

パッケージ
ダウンロード数
Stars
サイズ
Issues
公開日時
ライセンス
zip-stream22,091,1331669.33 kB271年前MIT
archiver02,95343.1 kB1562年前MIT
tar09092.24 MB102日前BlueOak-1.0.0
tar-fs038218.2 kB121日前MIT
tar-stream043732.1 kB1825日前MIT

機能比較: zip-stream vs archiver vs tar vs tar-fs vs tar-stream

圧縮形式のサポート

  • zip-stream:

    Zip-streamは、ZIP形式に特化しており、ストリーミングでの圧縮が可能です。

  • archiver:

    Archiverは、ZIP、TAR、GZなど、複数の圧縮形式をサポートしています。これにより、さまざまなアプリケーションでの使用が可能です。

  • tar:

    Tarは、主にtarball形式に特化しており、UNIX系システムでの互換性が高いです。

  • tar-fs:

    Tar-fsは、tar形式のアーカイブを作成するためのシンプルなインターフェースを提供します。

  • tar-stream:

    Tar-streamは、ストリーミング形式でtarアーカイブを作成するため、メモリ使用量を抑えつつ効率的に処理できます。

ストリーミングサポート

  • zip-stream:

    Zip-streamは、ストリーミングZIPアーカイブを作成するための効率的な方法を提供します。

  • archiver:

    Archiverは、ストリーミングAPIを提供し、ファイルをリアルタイムで圧縮できます。

  • tar:

    Tarは、ストリーミング機能を持たず、全体を一度に処理します。

  • tar-fs:

    Tar-fsは、ストリーミングAPIを提供し、ファイルシステムから直接データを取得できます。

  • tar-stream:

    Tar-streamは、ストリーミングアプローチを採用しており、データを逐次処理できます。

使用シナリオ

  • zip-stream:

    Zip-streamは、ストリーミングで大きなファイルを圧縮する場合に適しています。

  • archiver:

    Archiverは、さまざまな圧縮形式を必要とするアプリケーションに適しています。

  • tar:

    Tarは、UNIX系システムでのアーカイブ作成に最適です。

  • tar-fs:

    Tar-fsは、ファイルシステムから直接データを取得する必要がある場合に便利です。

  • tar-stream:

    Tar-streamは、リアルタイムでデータを処理する必要がある場合に最適です。

メモリ効率

  • zip-stream:

    Zip-streamは、ストリーミングZIPアーカイブを作成するため、メモリ効率が良いです。

  • archiver:

    Archiverは、ストリーミングを利用することでメモリ効率が良いです。

  • tar:

    Tarは、全体を一度に処理するため、大きなファイルではメモリ使用量が増加します。

  • tar-fs:

    Tar-fsは、ファイルシステムから直接データを取得するため、メモリ使用量を抑えられます。

  • tar-stream:

    Tar-streamは、ストリーミング処理によりメモリ使用量を最小限に抑えます。

APIの使いやすさ

  • zip-stream:

    Zip-streamは、ストリーミングZIPアーカイブを作成するための簡潔なAPIを提供します。

  • archiver:

    Archiverは、シンプルで直感的なAPIを提供しており、使いやすさが高いです。

  • tar:

    Tarは、シンプルなAPIですが、機能は限られています。

  • tar-fs:

    Tar-fsは、ファイルシステムからのデータ取得に特化したAPIを提供します。

  • tar-stream:

    Tar-streamは、ストリーミングAPIを提供し、柔軟性があります。

選び方: zip-stream vs archiver vs tar vs tar-fs vs tar-stream

  • zip-stream:

    Zip-streamは、ストリーミングZIPアーカイブを作成するためのライブラリです。大きなファイルを分割して圧縮したり、リアルタイムでデータを圧縮する必要がある場合に最適です。

  • archiver:

    Archiverは、ZIPやTARなどのアーカイブ形式をサポートしており、ストリーミングAPIを提供します。ファイルを簡単に圧縮したい場合や、複数の形式をサポートする必要がある場合に最適です。

  • tar:

    Tarは、UNIX系のシステムで広く使用されているアーカイブ形式で、特にtarballの作成に適しています。シンプルで効率的なアーカイブ作成が必要な場合に選択してください。

  • tar-fs:

    Tar-fsは、ファイルシステムから直接tarアーカイブを作成するためのライブラリです。ファイルシステムのストリーミングを利用したい場合や、ファイルを直接操作する必要がある場合に適しています。

  • tar-stream:

    Tar-streamは、ストリーミングAPIを提供するtarアーカイブ作成用のライブラリです。メモリ効率が良く、リアルタイムでのデータ処理が必要な場合に選択してください。

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.