package/package.json000664 001750 001750 0000001200 12376500255013017 0ustar00000000 000000 {
"name": "is-gzip",
"version": "1.0.0",
"description": "Check if a Buffer/Uint8Array is a GZIP file",
"license": "MIT",
"repository": "kevva/is-gzip",
"author": {
"name": "Kevin Mårtensson",
"email": "kevinmartensson@gmail.com",
"url": "https://github.com/kevva"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "node test/test.js"
},
"files": [
"index.js"
],
"keywords": [
"archive",
"buffer",
"check",
"detect",
"gzip",
"type",
"uint8array"
],
"devDependencies": {
"ava": "0.0.4",
"mocha": "^1.18.2",
"read-chunk": "^1.0.0"
}
}
package/README.md000664 001750 001750 0000000726 12376500135012021 0ustar00000000 000000 # is-gzip [](https://travis-ci.org/kevva/is-gzip)
> Check if a Buffer/Uint8Array is a GZIP file
## Install
```sh
$ npm install --save is-gzip
```
## Usage
```js
var isGzip = require('is-gzip');
var read = require('fs').readFileSync;
isGzip(read('foo.tar.gz'));
// => true
```
## License
[MIT License](http://en.wikipedia.org/wiki/MIT_License) © [Kevin Mårtensson](https://github.com/kevva)
package/index.js000664 001750 001750 0000000420 12376500057012201 0ustar00000000 000000 'use strict';
/**
* Check if a Buffer/Uint8Array is a GZIP file
*
* @param {Buffer} buf
* @api public
*/
module.exports = function (buf) {
if (!buf || buf.length < 3) {
return false;
}
return buf[0] === 31 && buf[1] === 139 && buf[2] === 8;
};