mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
refactor(packer) unpack: checkExt -> regexp
This commit is contained in:
parent
220da11388
commit
846f91997b
1 changed files with 3 additions and 6 deletions
|
|
@ -61,19 +61,16 @@
|
|||
|
||||
exports.unpack = function(from, to, callback) {
|
||||
var write,
|
||||
isStr = Util.type.string(from),
|
||||
check = Util.checkExt,
|
||||
isTarGz = isStr && check(from, 'tar.gz'),
|
||||
isTarGz = /\.tar\.gz$/.test(from),
|
||||
|
||||
options = {
|
||||
gunzip : true
|
||||
};
|
||||
|
||||
if (tar && isTarGz) {
|
||||
if (isTarGz)
|
||||
write = tar.Extract({ path: to });
|
||||
} else {
|
||||
else
|
||||
write = to;
|
||||
}
|
||||
|
||||
files.pipe(from, write, options, callback);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue