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
file-type
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.
compressible
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.
is-gzip 
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'));
License
MIT © Kevin Mårtensson