adm-zip vs archiver vs node-zip vs yauzl vs yazl vs zip-lib
Node.js ZIPライブラリ
adm-ziparchivernode-zipyauzlyazlzip-lib類似パッケージ:

Node.js ZIPライブラリ

ZIPライブラリは、Node.js環境でZIPファイルを作成、操作、解凍するためのツールです。これらのライブラリは、ファイルの圧縮や解凍を簡単に行うことができ、特にデータの転送や保存を効率化するために使用されます。各ライブラリは異なる機能や使用シナリオを持ち、開発者はプロジェクトの要件に応じて最適なものを選択する必要があります。

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

3 年

GitHub Starsランキング

統計詳細

パッケージ
ダウンロード数
Stars
サイズ
Issues
公開日時
ライセンス
adm-zip02,162122 kB14417日前MIT
archiver02,95043.1 kB1562年前MIT
node-zip0217-2011年前-
yauzl080197.7 kB1518日前MIT
yazl037558.7 kB191年前MIT
zip-lib04270.2 kB15日前MIT

機能比較: adm-zip vs archiver vs node-zip vs yauzl vs yazl vs zip-lib

APIの使いやすさ

  • adm-zip:

    シンプルで直感的なAPIを提供し、初心者でも簡単に使い始めることができます。

  • archiver:

    ストリーミングAPIを提供しており、柔軟性が高いですが、やや複雑な設定が必要です。

  • node-zip:

    基本的な機能に特化しており、簡単に使えるが、機能は限られています。

  • yauzl:

    ZIPファイルの読み込みに特化しており、APIはシンプルですが、書き込み機能はありません。

  • yazl:

    ストリーミングAPIを持ち、高速な圧縮が可能ですが、学習コストがやや高いです。

  • zip-lib:

    オブジェクト指向の設計で、使いやすさと拡張性を兼ね備えています。

パフォーマンス

  • adm-zip:

    小規模なファイルの圧縮には適していますが、大規模なデータセットの場合はパフォーマンスが低下する可能性があります。

  • archiver:

    ストリーミングを利用することで、大規模なデータの圧縮を効率的に行えます。

  • node-zip:

    シンプルな実装で、パフォーマンスは良好ですが、機能が限られています。

  • yauzl:

    メモリ効率が良く、大きなZIPファイルの読み込みに適しています。

  • yazl:

    高性能な圧縮を提供し、大規模なデータセットに対しても優れたパフォーマンスを発揮します。

  • zip-lib:

    オブジェクト指向のアプローチにより、パフォーマンスと拡張性を両立しています。

機能の豊富さ

  • adm-zip:

    基本的な圧縮・解凍機能を提供しますが、他のライブラリに比べて機能は限られています。

  • archiver:

    多様な圧縮フォーマットをサポートし、機能が豊富です。

  • node-zip:

    シンプルな機能に特化しており、他のライブラリに比べて機能は少ないです。

  • yauzl:

    読み込み専用の機能に特化しており、圧縮機能はありません。

  • yazl:

    高性能な圧縮機能を持ち、ストリーミングに対応しています。

  • zip-lib:

    カスタマイズ可能な機能を提供し、拡張性があります。

ストリーミングサポート

  • adm-zip:

    ストリーミング機能は提供していません。

  • archiver:

    ストリーミングAPIを持ち、大規模なデータの処理に適しています。

  • node-zip:

    ストリーミング機能はありません。

  • yauzl:

    ZIPファイルの読み込みに特化しており、ストリーミングには対応していません。

  • yazl:

    ストリーミング機能を持ち、高速な圧縮が可能です。

  • zip-lib:

    ストリーミング機能は提供していませんが、オブジェクト指向の設計が特徴です。

学習曲線

  • adm-zip:

    非常にシンプルで、初心者でもすぐに使いこなせるでしょう。

  • archiver:

    ストリーミングAPIの理解が必要で、学習曲線はやや急です。

  • node-zip:

    シンプルなAPIのため、学習は容易です。

  • yauzl:

    特化した機能のため、学習は比較的簡単ですが、書き込み機能がないことに注意が必要です。

  • yazl:

    高性能な機能を持つため、学習曲線はやや急ですが、使いこなせれば非常に強力です。

  • zip-lib:

    オブジェクト指向の設計が特徴で、学習曲線は比較的緩やかです。

選び方: adm-zip vs archiver vs node-zip vs yauzl vs yazl vs zip-lib

  • adm-zip:

    簡単なAPIとシンプルなZIPファイルの作成・解凍機能を求める場合に最適です。特に小規模なプロジェクトや簡単なタスクに向いています。

  • archiver:

    ストリーミングAPIを利用して大規模なデータを効率的に圧縮したい場合に適しています。多様な圧縮フォーマットをサポートしており、柔軟性があります。

  • node-zip:

    シンプルなZIPファイルの作成が必要な場合に適していますが、他のライブラリに比べて機能が限られています。

  • yauzl:

    ZIPファイルの読み込みに特化しており、大きなファイルを扱う際にメモリ効率が良いです。特に読み取り専用の用途に向いています。

  • yazl:

    高性能なZIPファイルの作成に特化しており、ストリーミング機能を持っています。大規模なデータセットの圧縮に適しています。

  • zip-lib:

    オブジェクト指向のアプローチで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 });
.
.
.