Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
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.
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
});
The file-type package goes beyond just checking for gzip compression; it can determine the file type of a buffer/Uint8Array. This package can detect many different file types including images, videos, fonts, and more. It is more comprehensive than is-gzip, which is solely focused on gzip compression detection.
The compressible package is used to determine if a given MIME type is compressible. While it does not directly check buffers like is-gzip, it can be used in conjunction with other methods to infer if a file type is generally suitable for gzip compression.
Check if a Buffer/Uint8Array is a GZIP file
$ npm install is-gzip
const fs = require('fs');
const isGzip = require('is-gzip');
isGzip(fs.readFileSync('foo.tar.gz'));
//=> true
MIT © Kevin Mårtensson
FAQs
Check if a Buffer/Uint8Array is a GZIP file
The npm package is-gzip receives a total of 2,066,769 weekly downloads. As such, is-gzip popularity was classified as popular.
We found that is-gzip demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.