Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

is-deflate

watson7.5mMIT1.0.0

Detect if a Buffer/Uint8Array is compressed using deflate

deflate, inflate, compression, zlib, test

readme

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