Socket
Socket
Sign inDemoInstall

decompress-tarbz2

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

decompress-tarbz2 - npm Package Compare versions

Comparing version 2.0.2 to 3.0.0

license

90

index.js

@@ -10,64 +10,50 @@ 'use strict';

/**
* tar.bz2 decompress plugin
*
* @param {Object} opts
* @api public
*/
module.exports = function (opts) {
opts = opts || {};
opts.strip = +opts.strip || 0;
opts = opts || {};
opts.strip = +opts.strip || 0;
return through.obj(function (file, enc, cb) {
var self = this;
var extract = tar.extract();
return through.obj(function (file, enc, cb) {
var self = this;
var extract = tar.extract();
if (file.isNull()) {
cb(null, file);
return;
}
if (file.isNull()) {
cb(null, file);
return;
}
if (file.isStream()) {
cb(new Error('Streaming is not supported'));
return;
}
if (file.isStream()) {
cb(new Error('Streaming is not supported'));
return;
}
if (!isBzip2(file.contents)) {
cb(null, file);
return;
}
if (!file.extract || !isBzip2(file.contents)) {
cb(null, file);
return;
}
extract.on('error', function (err) {
cb(err);
return;
});
extract.on('entry', function (header, stream, done) {
var chunk = [];
var len = 0;
extract.on('entry', function (header, stream, done) {
var chunk = [];
var len = 0;
stream.on('data', function (data) {
chunk.push(data);
len += data.length;
});
stream.on('data', function (data) {
chunk.push(data);
len += data.length;
});
stream.on('end', function () {
if (header.type !== 'directory') {
self.push(new File({
contents: Buffer.concat(chunk, len),
path: stripDirs(header.name, opts.strip)
}));
}
stream.on('end', function () {
if (header.type !== 'directory') {
self.push(new File({
contents: Buffer.concat(chunk, len),
path: stripDirs(header.name, opts.strip)
}));
}
done();
});
});
done();
});
});
extract.on('finish', function () {
cb();
});
extract.end(bz2.decode(file.contents));
});
extract.on('error', cb);
extract.on('finish', cb);
extract.end(bz2.decode(file.contents));
});
};
{
"name": "decompress-tarbz2",
"version": "2.0.2",
"version": "3.0.0",
"description": "decompress tar.bz2 plugin",

@@ -34,4 +34,4 @@ "license": "MIT",

"seek-bzip": "^1.0.3",
"strip-dirs": "^0.1.1",
"tar-stream": "^0.4.5",
"strip-dirs": "^1.0.0",
"tar-stream": "^1.1.1",
"through2": "^0.6.1",

@@ -38,0 +38,0 @@ "vinyl": "^0.4.3"

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc