is-deflate
v1.0.0
Published
Detect if a Buffer/Uint8Array is compressed using deflate
Downloads
11,344,714
Maintainers
Readme
is-deflate
Check if a given Buffer
or Uint8Array
is
deflate compressed.
Installation
npm install is-deflate --save
Usage
var fs = require('fs')
var zlib = require('zlib')
var isDeflate = require('is-deflate')
var buf = fs.readFileSync('my-file')
if (isDeflate(buf)) {
zlib.inflate(buf, function (err, data) {
if (err) throw err
console.log(data)
})
}
License
MIT