adm-zip vs yazl vs zip-a-folder vs node-zip vs zip-lib
Node.jsのZIPライブラリ
adm-zipyazlzip-a-foldernode-zipzip-lib類似パッケージ:

Node.jsのZIPライブラリ

Node.jsのZIPライブラリは、ファイルやフォルダをZIP形式で圧縮したり、解凍したりするためのツールです。これらのライブラリは、データの圧縮、アーカイブの作成、ファイルの転送を効率化し、ストレージの使用を最適化するのに役立ちます。特に、ウェブアプリケーションやサーバーサイドのスクリプトで、データを圧縮して送信する際に非常に便利です。

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

3 年

GitHub Starsランキング

統計詳細

パッケージ
ダウンロード数
Stars
サイズ
Issues
公開日時
ライセンス
adm-zip11,871,0812,159121 kB1482年前MIT
yazl2,352,51837558.7 kB191年前MIT
zip-a-folder188,9877667 kB03時間前MIT
node-zip88,403217-2011年前-
zip-lib04052.6 kB21ヶ月前MIT

機能比較: adm-zip vs yazl vs zip-a-folder vs node-zip vs zip-lib

APIのシンプルさ

  • adm-zip:

    adm-zipはシンプルで直感的なAPIを提供しており、ZIPファイルの作成や解凍が簡単に行えます。特に、少ないコードで操作できるため、初心者にも優しいです。

  • yazl:

    yazlは、シンプルなAPIを持ちながらも、高度な機能を提供します。特に、圧縮のパフォーマンスを重視する開発者に向いています。

  • zip-a-folder:

    zip-a-folderは、コマンドラインインターフェース(CLI)を通じて簡単にフォルダをZIP圧縮できるシンプルなAPIを提供します。

  • node-zip:

    node-zipはストリームベースのAPIを提供しており、少し複雑ですが、より柔軟な操作が可能です。大きなファイルを扱う際には、ストリーム処理が役立ちます。

  • zip-lib:

    zip-libは、柔軟なAPIを提供し、カスタマイズが可能です。特に、特定のニーズに合わせた機能を追加したい場合に適しています。

パフォーマンス

  • adm-zip:

    adm-zipは、一般的な用途には十分なパフォーマンスを提供しますが、大きなファイルの処理には向いていない場合があります。

  • yazl:

    yazlは、特に大きなファイルの圧縮において高いパフォーマンスを発揮します。圧縮率も高く、効率的な処理が可能です。

  • zip-a-folder:

    zip-a-folderは、フォルダ全体を圧縮する際に便利で、迅速に処理を行いますが、個別のファイル操作には向いていません。

  • node-zip:

    node-zipは、ストリーム処理を利用することで、メモリ使用量を抑えつつ大きなファイルを効率的に処理できます。

  • zip-lib:

    zip-libは、カスタム圧縮オプションを提供し、特定のニーズに応じたパフォーマンスを引き出すことができます。

使用シナリオ

  • adm-zip:

    小規模なプロジェクトや、簡単なZIPファイルの作成・解凍が必要なシナリオに最適です。

  • yazl:

    高パフォーマンスが求められるシナリオ、特に大きなデータセットを扱う際に最適です。

  • zip-a-folder:

    フォルダ全体を簡単に圧縮したい場合、特にCLIを使用するシナリオに便利です。

  • node-zip:

    大きなファイルをストリームで処理する必要がある場合に適しています。特に、メモリを節約したい場合に有効です。

  • zip-lib:

    高度な機能やカスタマイズが必要な場合、特に大規模なプロジェクトに適しています。

拡張性

  • adm-zip:

    adm-zipは基本的な機能に特化しており、拡張性は限られていますが、シンプルさが魅力です。

  • yazl:

    yazlは、圧縮アルゴリズムの選択肢があり、拡張性が高いです。特に、特定のニーズに応じたカスタマイズが可能です。

  • zip-a-folder:

    zip-a-folderは、主にフォルダ圧縮に特化しており、拡張性はあまりありません。

  • node-zip:

    node-zipはストリームベースのアプローチを採用しており、拡張性が高く、複雑な処理にも対応できます。

  • zip-lib:

    zip-libは、柔軟な設計により、さまざまな機能を追加できるため、高い拡張性を持っています。

メンテナンス

  • adm-zip:

    adm-zipはシンプルな設計のため、メンテナンスが容易です。

  • yazl:

    yazlは、パフォーマンスを重視した設計で、メンテナンスは比較的簡単です。

  • zip-a-folder:

    zip-a-folderは、シンプルなAPIを持ち、メンテナンスが容易です。

  • node-zip:

    node-zipはストリーム処理に特化しているため、メンテナンスはやや複雑ですが、効率的です。

  • zip-lib:

    zip-libは、柔軟性が高い反面、メンテナンスには注意が必要ですが、カスタマイズ性が高いです。

選び方: adm-zip vs yazl vs zip-a-folder vs node-zip vs zip-lib

  • adm-zip:

    簡単なZIPファイルの作成や解凍が必要な場合に最適です。シンプルなAPIを提供し、特に小規模なプロジェクトに適しています。

  • yazl:

    高性能なZIPファイルの作成が必要な場合に適しています。特に大きなファイルを扱う際に、効率的な圧縮を提供します。

  • zip-a-folder:

    フォルダ全体を簡単にZIP圧縮したい場合に便利です。CLIからも使用でき、使い勝手が良いです。

  • node-zip:

    ストリームベースの操作が必要な場合に選択すべきです。大きなファイルの処理や、メモリ使用量を抑えたい場合に有効です。

  • zip-lib:

    柔軟性と拡張性を重視する場合に選択してください。カスタム圧縮オプションや高度な機能を必要とするプロジェクトに適しています。

adm-zip のREADME

ADM-ZIP for NodeJS

ADM-ZIP is a pure JavaScript implementation for zip data compression for NodeJS.

Build Status

Installation

With npm do:

$ npm install adm-zip

Electron file system support described below.

What is it good for?

The library allows you to:

  • decompress zip files directly to disk or in memory buffers
  • compress files and store them to disk in .zip format or in compressed buffers
  • update content of/add new/delete files from an existing .zip

Dependencies

There are no other nodeJS libraries that ADM-ZIP is dependent of

Examples

Basic usage

var AdmZip = require("adm-zip");

// reading archives
var zip = new AdmZip("./my_file.zip");
var password = "1234567890";
var zipEntries = zip.getEntries(); // an array of ZipEntry records - add password parameter if entries are password protected

zipEntries.forEach(function (zipEntry) {
    console.log(zipEntry.toString()); // outputs zip entries information
    if (zipEntry.entryName == "my_file.txt") {
        console.log(zipEntry.getData().toString("utf8"));
    }
});
// outputs the content of some_folder/my_file.txt
console.log(zip.readAsText("some_folder/my_file.txt"));
// extracts the specified file to the specified location
zip.extractEntryTo(/*entry name*/ "some_folder/my_file.txt", /*target path*/ "/home/me/tempfolder", /*maintainEntryPath*/ false, /*overwrite*/ true);
// extracts everything
zip.extractAllTo(/*target path*/ "/home/me/zipcontent/", /*overwrite*/ true);

// creating archives
var zip = new AdmZip();

// add file directly
var content = "inner content of the file";
zip.addFile("test.txt", Buffer.from(content, "utf8"), "entry comment goes here");
// add local file
zip.addLocalFile("/home/me/some_picture.png");
// get everything as a buffer
var willSendthis = zip.toBuffer();
// or write everything to disk
zip.writeZip(/*target file name*/ "/home/me/files.zip");

// ... more examples in the wiki

For more detailed information please check out the wiki.

Electron original-fs

ADM-ZIP has supported electron original-fs for years without any user interractions but it causes problem with bundlers like rollup etc. For continuing support original-fs or any other custom file system module. There is possible specify your module by fs option in ADM-ZIP constructor.

Example:

const AdmZip = require("adm-zip");
const OriginalFs = require("original-fs");

// reading archives
const zip = new AdmZip("./my_file.zip", { fs: OriginalFs });
.
.
.