Comparing version 2.0.0 to 2.1.0
20
index.js
@@ -16,10 +16,21 @@ | ||
|| 'identity' | ||
var decompression | ||
switch (encoding) { | ||
case 'gzip': | ||
case 'deflate': | ||
delete options.brotli | ||
delete options.encoding | ||
decompression = zlib.createUnzip(options) | ||
break | ||
case 'br': | ||
if (zlib.createBrotliDecompress) { | ||
decompression = zlib.createBrotliDecompress(options.brotli) | ||
} | ||
break | ||
case 'identity': | ||
return stream | ||
default: | ||
} | ||
if (!decompression) { | ||
var err = new Error('Unsupported Content-Encoding: ' + encoding) | ||
@@ -30,6 +41,3 @@ err.status = 415 | ||
// no not pass-through encoding | ||
delete options.encoding | ||
return stream.pipe(zlib.Unzip(options)) | ||
return stream.pipe(decompression) | ||
} |
{ | ||
"name": "inflation", | ||
"description": "Easily unzip an HTTP stream", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"author": "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)", | ||
@@ -13,7 +13,9 @@ "license": "MIT", | ||
"zlib", | ||
"gunzip" | ||
"gunzip", | ||
"brotli" | ||
], | ||
"devDependencies": { | ||
"git-contributor": "^2.1.5", | ||
"istanbul": "0.2.10", | ||
"mocha": "~1.20.1", | ||
"mocha": "^10.2.0", | ||
"readable-stream": "~1.0.27", | ||
@@ -26,5 +28,5 @@ "should": "4.0.4" | ||
"scripts": { | ||
"test": "mocha --reporter spec --bail test/", | ||
"test": "mocha --reporter spec --bail test/*.js", | ||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/", | ||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec test/" | ||
"contributor": "git-contributor" | ||
}, | ||
@@ -31,0 +33,0 @@ "files": [ |
# inflation | ||
[![NPM version](https://badge.fury.io/js/inflation.svg)](http://badge.fury.io/js/inflation) | ||
[![Build Status](https://travis-ci.org/stream-utils/inflation.svg?branch=master)](https://travis-ci.org/stream-utils/inflation) | ||
[![Coverage Status](https://img.shields.io/coveralls/stream-utils/inflation.svg?branch=master)](https://coveralls.io/r/stream-utils/inflation) | ||
[![CI](https://github.com/stream-utils/inflation/actions/workflows/nodejs.yml/badge.svg)](https://github.com/stream-utils/inflation/actions/workflows/nodejs.yml) | ||
@@ -23,2 +22,3 @@ Automatically unzip an HTTP stream. | ||
If not given, will look in `stream.headers['content-encoding']`. | ||
- `brotli` - [`BrotliOptions`](https://nodejs.org/api/zlib.html#class-brotlioptions) to use for Brotli decompression | ||
@@ -37,1 +37,13 @@ ## Example | ||
``` | ||
<!-- GITCONTRIBUTOR_START --> | ||
## Contributors | ||
|[<img src="https://avatars.githubusercontent.com/u/67512?v=4" width="100px;"/><br/><sub><b>dougwilson</b></sub>](https://github.com/dougwilson)<br/>|[<img src="https://avatars.githubusercontent.com/u/73755?v=4" width="100px;"/><br/><sub><b>bminer</b></sub>](https://github.com/bminer)<br/>|[<img src="https://avatars.githubusercontent.com/u/156269?v=4" width="100px;"/><br/><sub><b>fengmk2</b></sub>](https://github.com/fengmk2)<br/>| | ||
| :---: | :---: | :---: | | ||
This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Sat Oct 14 2023 12:55:08 GMT+0800`. | ||
<!-- GITCONTRIBUTOR_END --> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4345
33
48
5
4
1