decompress-tarbz2
Advanced tools
Comparing version 2.0.2 to 3.0.0
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" |
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
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
4206
4
58
47
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.1(transitive)
+ Addedbl@1.2.3(transitive)
+ Addedbuffer-alloc@1.2.0(transitive)
+ Addedbuffer-alloc-unsafe@1.1.0(transitive)
+ Addedbuffer-fill@1.0.0(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedfs-constants@1.0.0(transitive)
+ Addedget-stdin@4.0.1(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedis-natural-number@2.1.1(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedsafe-buffer@5.1.25.2.1(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedstrip-dirs@1.1.1(transitive)
+ Addedsum-up@1.0.3(transitive)
+ Addedsupports-color@2.0.0(transitive)
+ Addedtar-stream@1.6.2(transitive)
+ Addedto-buffer@1.1.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
- Removedansi-regex@0.2.1(transitive)
- Removedansi-styles@1.1.0(transitive)
- Removedbl@0.9.5(transitive)
- Removedchalk@0.5.1(transitive)
- Removedget-stdin@3.0.2(transitive)
- Removedhas-ansi@0.1.0(transitive)
- Removedis-finite@1.1.0(transitive)
- Removedis-integer@1.0.7(transitive)
- Removedreadable-stream@1.1.14(transitive)
- Removedstrip-ansi@0.3.0(transitive)
- Removedstrip-dirs@0.1.1(transitive)
- Removedsupports-color@0.2.0(transitive)
- Removedtar-stream@0.4.7(transitive)
Updatedstrip-dirs@^1.0.0
Updatedtar-stream@^1.1.1