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