0.5.16 • Published 1 month ago

adm-zip v0.5.16

Weekly downloads
2,944,887
License
MIT
Repository
github
Last release
1 month ago

ADM-ZIP for NodeJS

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

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 });
.
.
.
webdriver-managerzk-cli@build-tools-for-vmware-aria/codify@microsoft/teamsfx-cli@dxatscale/sfpowerscripts@falloutstudios/rmm@serverless/components@zjinh/electron-builder-encryptoradcharity-remarkable-apiautomation-scripts@architect-io/cli@serverless-devs/s-beta@serverless-dev/s-testnextless@pil0t/gatsby-theme-novelacodeserver@thirdwave-network/thirdwave-gatsby-themeshocky@darkhm/essence-constructor-scriptsxploreofficeewa-ts-cli@maxtan/wonders-tohtml@kyrelldixon/gatsby-theme-novelakurigashvili-testpackagekurigashvili-testpackage-xmagnoabsass-sdfddabc-jdjdjjdnextf@tizentv/witstestdocx-parseqkube-cliwits-beta-testtenantparser@sirius-black/taro-clithinkclear-common-utilreacttsx-scripts@tizentv/testhpe-sfdx-pluginswooooosikwooooosik11wooooosik12wooooosik13wooooosik5wooooosik7wooooosik8@tizentv/testmodule@coder/code-serverganister-installerthutilityui5-createwebpack-builder-zipfoldercv3-clidev-agnitio-cliftscsourcify-validationpluxury-cli@merthin/ark@merthin/ced-clicustom-gatsby-theme-novelakakuri-ask-clikakuri2-ask-cli@audio-project-manager/apm-clitestioportblipabrown-sample-pluginwinrader@studiorack/studiorack-clids-linear-service@plurid/developer-clioakmont-bakery-posfim1solrservenvato-climaestro-vsc-extension-pluginshopseg-bee-climidhub-contractsasm-auto-deploydendro-cli@pega/custom-component@maximekjaer/tfjs-npylb-agora-classroom-edu-sdknode-kotlinraykgustin-excel2jsoncamscripter-rabsberry@equippedcoding/appfactorysxyj_taro_cli@skoda-dms/basic-lib@interaktiv/mibuildernodes-vscode-utilsnodejs-vscode-utilsnode-ts-file@totvslabs/carolmarjory-factory-clibds_maneger_api@massbit/indexer-managerbds-manegemcplug.jsgenerator-nearby@ionic/e2e
0.5.16

1 month ago

0.5.15

2 months ago

0.5.14

4 months ago

0.5.13

4 months ago

0.5.11

7 months ago

0.5.12

7 months ago

0.5.10

2 years ago

0.5.8

3 years ago

0.5.7

3 years ago

0.5.9

3 years ago

0.5.6

3 years ago

0.5.5

4 years ago

0.5.4

4 years ago

0.5.3

4 years ago

0.5.2

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.16

4 years ago

0.4.14

5 years ago

0.4.13

6 years ago

0.4.11

6 years ago

0.4.10

6 years ago

0.4.9

6 years ago

0.4.8

6 years ago

0.4.7

10 years ago

0.4.6

10 years ago

0.4.5

10 years ago

0.4.4

11 years ago

0.4.3

11 years ago

0.2.1

12 years ago

0.2.0

12 years ago

0.1.9

12 years ago

0.1.8

12 years ago

0.1.7

12 years ago

0.1.6

12 years ago

0.1.5

12 years ago

0.1.4

12 years ago

0.1.3

13 years ago

0.1.2

13 years ago

0.1.1

13 years ago