is-deflate

1.0.0 • Public • Published

is-deflate

Check if a given Buffer or Uint8Array is deflate compressed.

Build status js-standard-style

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

Package Sidebar

Install

npm i is-deflate

Weekly Downloads

3,517,684

Version

1.0.0

License

MIT

Last publish

Collaborators

  • watson