Socket
Socket
Sign inDemoInstall

gunzip-maybe

Package Overview
Dependencies
22
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.2.0

9

index.js
var zlib = require('zlib');
var peek = require('peek-stream')
var through = require('through2')
var pumpify = require('pumpify')

@@ -12,6 +13,8 @@ var isGzipped = function(data) {

module.exports = function() {
var gunzip = function() {
return peek({newline:false, maxBuffer:10}, function(data, swap) {
swap(null, isGzipped(data) ? zlib.createGunzip() : through())
swap(null, isGzipped(data) ? pumpify(zlib.createGunzip(), gunzip()) : through())
})
}
}
module.exports = gunzip;
{
"name": "gunzip-maybe",
"description": "Transform stream that gunzips its input if it is gunzipped and just echoes it if not",
"version": "1.1.0",
"version": "1.2.0",
"repository": "mafintosh/gunzip-maybe",

@@ -9,2 +9,3 @@ "dependencies": {

"peek-stream": "^1.1.0",
"pumpify": "^1.3.3",
"through2": "^0.4.1"

@@ -11,0 +12,0 @@ },

@@ -17,2 +17,13 @@ var tape = require('tape');

tape('gunzipped multiple times', function(t) {
fs.createReadStream(__filename)
.pipe(zlib.createGzip())
.pipe(zlib.createGzip())
.pipe(gunzip())
.pipe(concat(function(data) {
t.same(data, fs.readFileSync(__filename));
t.end();
}))
});
tape('regular input', function(t) {

@@ -19,0 +30,0 @@ fs.createReadStream(__filename)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc