adm-zip vs archiver vs jszip vs zip-local
Node.jsのZIPライブラリ
adm-ziparchiverjszipzip-local類似パッケージ:

Node.jsのZIPライブラリ

これらのライブラリは、Node.js環境でZIPファイルを作成、解凍、操作するためのツールです。各ライブラリは異なる機能や特性を持ち、特定のニーズに応じて選択することができます。これにより、開発者はファイルの圧縮や展開を簡単に行うことができ、アプリケーションのパフォーマンスを向上させることができます。

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

3 年

GitHub Starsランキング

統計詳細

パッケージ
ダウンロード数
Stars
サイズ
Issues
公開日時
ライセンス
adm-zip02,159122 kB14411日前MIT
archiver02,94943.1 kB1562年前MIT
jszip010,336762 kB410-(MIT OR GPL-3.0-or-later)
zip-local012057.1 kB13--

機能比較: adm-zip vs archiver vs jszip vs zip-local

使いやすさ

  • adm-zip:

    adm-zipはシンプルなAPIを提供しており、ZIPファイルの作成や解凍が直感的に行えます。特に小規模なプロジェクトや簡単なタスクに最適です。

  • archiver:

    archiverはストリーミングAPIを提供しており、大きなファイルを扱う際に効率的です。設定が少し複雑ですが、柔軟性があります。

  • jszip:

    jszipはブラウザで動作するため、クライアントサイドでのZIP操作が簡単に行えます。APIもシンプルで、すぐに使い始めることができます。

  • zip-local:

    zip-localは非常にシンプルで、ローカルファイルの圧縮や解凍が簡単に行えます。特に初心者に優しい設計です。

パフォーマンス

  • adm-zip:

    小さなファイルの操作においては非常に高速ですが、大きなファイルを扱う際にはメモリ使用量が増える可能性があります。

  • archiver:

    ストリーミングを利用することで、大きなファイルでも効率的に処理できます。メモリ使用量を抑えつつ、パフォーマンスを維持します。

  • jszip:

    クライアントサイドでの処理に特化しており、ブラウザの性能に依存します。大きなファイルの場合、パフォーマンスが低下することがあります。

  • zip-local:

    シンプルな操作においては良好なパフォーマンスを発揮しますが、大規模なファイル操作には向いていません。

機能の豊富さ

  • adm-zip:

    基本的なZIPファイルの作成と解凍機能を提供しますが、他のフォーマットには対応していません。

  • archiver:

    ZIPだけでなく、tarやgzipなど多様なフォーマットをサポートしており、機能が豊富です。

  • jszip:

    ZIPファイルの作成と解凍に特化しており、圧縮レベルの設定なども可能です。

  • zip-local:

    基本的なZIP操作に特化しており、他のフォーマットには対応していません。

ストリーミングサポート

  • adm-zip:

    ストリーミング操作には対応していません。全てのデータをメモリに読み込む必要があります。

  • archiver:

    ストリーミングAPIを提供しており、大きなデータを効率的に処理できます。

  • jszip:

    ストリーミング操作には対応していませんが、クライアントサイドでの操作に特化しています。

  • zip-local:

    ストリーミング機能はありませんが、シンプルな操作には適しています。

サポートとメンテナンス

  • adm-zip:

    活発なメンテナンスが行われており、問題があれば迅速に対応されます。

  • archiver:

    広く使用されており、コミュニティからのサポートも充実しています。

  • jszip:

    人気のあるライブラリで、ドキュメントも豊富です。

  • zip-local:

    シンプルなライブラリですが、サポートは限られています。

選び方: adm-zip vs archiver vs jszip vs zip-local

  • adm-zip:

    簡単なZIPファイルの作成や解凍が必要な場合に選択してください。シンプルなAPIで、迅速な実装が可能です。

  • archiver:

    ストリーミングAPIを使用して大きなファイルを扱う必要がある場合に選択してください。多様なフォーマットをサポートし、柔軟性があります。

  • jszip:

    クライアントサイドでのZIP操作が必要な場合に選択してください。ブラウザで動作し、簡単に使用できます。

  • zip-local:

    ローカルファイルシステムに対する簡単なZIP操作が必要な場合に選択してください。シンプルで使いやすいです。

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 });
.
.
.