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

compress-commons

Package Overview
Dependencies
Maintainers
0
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compress-commons

a library that defines a common interface for working with archive formats within node

  • 7.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created

What is compress-commons?

The compress-commons npm package is a library that provides a set of reusable classes and functions for creating and extracting archive files. It supports various archive formats, making it a versatile tool for handling compression and decompression tasks in Node.js applications.

What are compress-commons's main functionalities?

Creating Archive Files

This feature allows you to create archive files. The code sample demonstrates how to create a TAR archive containing a single file with the content 'Hello World!'.

const fs = require('fs');
const tar = require('compress-commons').tar;
const output = fs.createWriteStream('archive.tar');
const archive = tar.createArchiveStream();
output.on('close', function() {
  console.log('Archive has been finalized.');
});
archive.pipe(output);
archive.entry('file.txt', 'Hello World!', function(err) {
  if (err) throw err;
  archive.finish();
});

Extracting Archive Files

This feature enables the extraction of archive files. The provided code sample shows how to extract files from a TAR archive, handling each entry and completing the process.

const fs = require('fs');
const tar = require('compress-commons').tar;
const input = fs.createReadStream('archive.tar');
const archive = tar.extractArchiveStream();
input.pipe(archive);
archive.on('entry', function(header, stream, next) {
  stream.on('end', next);
  stream.resume();
});
archive.on('finish', function() {
  console.log('Extraction complete.');
});

Other packages similar to compress-commons

Keywords

FAQs

Package last updated on 14 Oct 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