Socket
Socket
Sign inDemoInstall

is-gzip

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    is-gzip

Check if a Buffer/Uint8Array is a GZIP file


Version published
Weekly downloads
3.7M
decreased by-0.12%
Maintainers
1
Install size
3.12 kB
Created
Weekly downloads
 

Package description

What is is-gzip?

The is-gzip npm package is a simple utility that allows you to check if a given buffer is compressed using the gzip compression algorithm. It is useful when you need to determine the compression of data programmatically, especially when dealing with streams or files that may or may not be gzipped.

What are is-gzip's main functionalities?

Check if a buffer is gzipped

This feature allows you to check if a buffer (for example, the contents of a file read into memory) is gzipped. The function returns a boolean value indicating whether the buffer is gzipped or not.

const isGzip = require('is-gzip');
const fs = require('fs');

fs.readFile('file.gz', (err, data) => {
  if (err) throw err;
  console.log(isGzip(data)); // true or false
});

Other packages similar to is-gzip

Readme

Source

is-gzip Build Status

Check if a Buffer/Uint8Array is a GZIP file

Install

$ npm install is-gzip

Usage

const fs = require('fs');
const isGzip = require('is-gzip');

isGzip(fs.readFileSync('foo.tar.gz'));
//=> true

License

MIT © Kevin Mårtensson

Keywords

FAQs

Last updated on 13 Aug 2017

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc