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

unzip-stream

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unzip-stream

Process zip files using streaming API

  • 0.3.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
169K
decreased by-14.69%
Maintainers
1
Weekly downloads
 
Created

What is unzip-stream?

The unzip-stream npm package is a streaming unzip library for node.js. It allows you to extract files from a ZIP archive using a stream-based approach, which is efficient for handling large files or archives.

What are unzip-stream's main functionalities?

Extracting files from a ZIP archive

This feature allows you to extract all files from a ZIP archive to a specified directory. The code sample demonstrates how to read a ZIP file and extract its contents to an output path.

const fs = require('fs');
const unzip = require('unzip-stream');

fs.createReadStream('path/to/archive.zip')
  .pipe(unzip.Extract({ path: 'output/path' }))
  .on('close', () => console.log('Extraction complete.'));

Extracting specific files from a ZIP archive

This feature allows you to extract specific files from a ZIP archive. The code sample demonstrates how to parse a ZIP file and extract only a specific file, while ignoring others.

const fs = require('fs');
const unzip = require('unzip-stream');

fs.createReadStream('path/to/archive.zip')
  .pipe(unzip.Parse())
  .on('entry', function (entry) {
    const fileName = entry.path;
    if (fileName === 'specific/file.txt') {
      entry.pipe(fs.createWriteStream('output/path/file.txt'));
    } else {
      entry.autodrain();
    }
  });

Other packages similar to unzip-stream

Keywords

FAQs

Package last updated on 20 Apr 2024

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