Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

adm-zip

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adm-zip

Javascript implementation of zip for nodejs with support for electron original-fs. Allows user to create or extract zip files both in memory or to/from disk

  • 0.4.16
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.9M
increased by1.02%
Maintainers
1
Weekly downloads
 
Created

What is adm-zip?

The adm-zip npm package is a JavaScript library for ZIP archive manipulation. It allows users to work with ZIP files directly from their Node.js applications. With adm-zip, you can create, extract, and update ZIP archives without relying on external tools.

What are adm-zip's main functionalities?

Creating ZIP archives

This feature allows you to create a new ZIP archive and add files to it from the local filesystem. The 'writeZip' method is then used to write the archive to disk.

const AdmZip = require('adm-zip');
const zip = new AdmZip();
zip.addLocalFile('/path/to/file.txt');
zip.writeZip('/path/to/archive.zip');

Extracting ZIP archives

This feature enables you to extract the contents of a ZIP archive to a specified directory on the filesystem. The second parameter of 'extractAllTo' determines whether to overwrite existing files.

const AdmZip = require('adm-zip');
const zip = new AdmZip('/path/to/archive.zip');
zip.extractAllTo('/path/to/extract/', true);

Reading ZIP archives

This feature is used to read the contents of a ZIP archive and list its entries. You can iterate over the entries to get information about each file or directory in the archive.

const AdmZip = require('adm-zip');
const zip = new AdmZip('/path/to/archive.zip');
const zipEntries = zip.getEntries();
zipEntries.forEach((zipEntry) => {
  console.log(zipEntry.toString()); // outputs zip entries information
});

Updating ZIP archives

This feature allows you to update the contents of an existing file within a ZIP archive. The 'updateFile' method takes the filename and the new content as a Buffer.

const AdmZip = require('adm-zip');
const zip = new AdmZip('/path/to/archive.zip');
zip.updateFile('fileInsideZip.txt', Buffer.from('new content'));
zip.writeZip();

Other packages similar to adm-zip

Keywords

FAQs

Package last updated on 23 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc