package/package.json000644 000765 000024 0000001352 12651010156013013 0ustar00000000 000000 { "name": "is-deflate", "version": "1.0.0", "description": "Detect if a Buffer/Uint8Array is compressed using deflate", "main": "index.js", "dependencies": {}, "devDependencies": { "standard": "^5.4.1" }, "scripts": { "test": "standard" }, "repository": { "type": "git", "url": "git+https://github.com/watson/is-deflate.git" }, "keywords": [ "deflate", "inflate", "compression", "zlib", "test" ], "author": "Thomas Watson Steen (https://twitter.com/wa7son)", "license": "MIT", "bugs": { "url": "https://github.com/watson/is-deflate/issues" }, "homepage": "https://github.com/watson/is-deflate#readme", "coordinates": [ 55.6666671, 12.5798778 ] } package/.npmignore000644 000765 000024 0000000015 12651005516012523 0ustar00000000 000000 node_modules package/README.md000644 000765 000024 0000001313 12651010104011772 0ustar00000000 000000 # is-deflate Check if a given `Buffer` or `Uint8Array` is [deflate](https://en.wikipedia.org/wiki/DEFLATE) compressed. [![Build status](https://travis-ci.org/watson/is-deflate.svg?branch=master)](https://travis-ci.org/watson/is-deflate) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard) ## Installation ``` npm install is-deflate --save ``` ## Usage ```js 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/LICENSE000644 000765 000024 0000002076 12651005470011541 0ustar00000000 000000 The MIT License (MIT) Copyright (c) 2016 Thomas Watson Steen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. package/index.js000644 000765 000024 0000000256 12651006653012203 0ustar00000000 000000 'use strict' module.exports = function (buf) { if (!buf || buf.length < 2) return false return buf[0] === 0x78 && (buf[1] === 1 || buf[1] === 0x9c || buf[1] === 0xda) } package/.travis.yml000644 000765 000024 0000000041 12651005503012630 0ustar00000000 000000 language: node_js node_js: - '4'