Comparing version 3.0.0 to 3.1.0
17
index.js
@@ -0,1 +1,2 @@ | ||
/*! cross-zip. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ | ||
module.exports = { | ||
@@ -117,2 +118,6 @@ zip: zip, | ||
function quotePath (pathToTransform) { | ||
return '"' + pathToTransform + '"' | ||
} | ||
function getZipArgs (inPath, outPath) { | ||
@@ -123,5 +128,5 @@ if (process.platform === 'win32') { | ||
'-noprofile', | ||
'-command', '& { param([String]$myInPath, [String]$myOutPath); Add-Type -A "System.IO.Compression.FileSystem"; [IO.Compression.ZipFile]::CreateFromDirectory($myInPath, $myOutPath); }', | ||
'-myInPath', inPath, | ||
'-myOutPath', outPath | ||
'-command', '& { param([String]$myInPath, [String]$myOutPath); Add-Type -A "System.IO.Compression.FileSystem"; [IO.Compression.ZipFile]::CreateFromDirectory($myInPath, $myOutPath); exit !$? }', | ||
'-myInPath', quotePath(inPath), | ||
'-myOutPath', quotePath(outPath) | ||
] | ||
@@ -139,5 +144,5 @@ } else { | ||
'-noprofile', | ||
'-command', '& { param([String]$myInPath, [String]$myOutPath); Add-Type -A "System.IO.Compression.FileSystem"; [IO.Compression.ZipFile]::ExtractToDirectory($myInPath, $myOutPath); }', | ||
'-myInPath', inPath, | ||
'-myOutPath', outPath | ||
'-command', '& { param([String]$myInPath, [String]$myOutPath); Add-Type -A "System.IO.Compression.FileSystem"; [IO.Compression.ZipFile]::ExtractToDirectory($myInPath, $myOutPath); exit !$? }', | ||
'-myInPath', quotePath(inPath), | ||
'-myOutPath', quotePath(outPath) | ||
] | ||
@@ -144,0 +149,0 @@ } else { |
{ | ||
"name": "cross-zip", | ||
"description": "Cross-platform .zip file creation", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"author": { | ||
"name": "Feross Aboukhadijeh", | ||
"email": "feross@feross.org", | ||
"url": "http://feross.org/" | ||
"url": "https://feross.org" | ||
}, | ||
@@ -14,5 +14,4 @@ "bugs": { | ||
"devDependencies": { | ||
"mkdirp": "^0.5.1", | ||
"standard": "*", | ||
"tape": "^4.0.0" | ||
"tape": "^5.0.0" | ||
}, | ||
@@ -41,3 +40,17 @@ "homepage": "https://github.com/feross/cross-zip", | ||
"rimraf": "^3.0.0" | ||
} | ||
}, | ||
"funding": [ | ||
{ | ||
"type": "github", | ||
"url": "https://github.com/sponsors/feross" | ||
}, | ||
{ | ||
"type": "patreon", | ||
"url": "https://www.patreon.com/feross" | ||
}, | ||
{ | ||
"type": "consulting", | ||
"url": "https://feross.org/support" | ||
} | ||
] | ||
} |
var fs = require('fs') | ||
var mkdirp = require('mkdirp') | ||
var path = require('path') | ||
@@ -12,3 +11,3 @@ var rimraf = require('rimraf') | ||
mkdirp.sync(tmpPath) | ||
fs.mkdirSync(tmpPath, { recursive: true }) | ||
@@ -44,1 +43,24 @@ test('unzipSync', function (t) { | ||
}) | ||
test('unzip from a folder with a space in it', function (t) { | ||
t.plan(4) | ||
var zipSpacePath = path.join(tmpPath, 'folder space', path.basename(fileZipPath)) | ||
fs.mkdirSync(path.dirname(zipSpacePath), { recursive: true }) | ||
fs.copyFileSync(fileZipPath, zipSpacePath) | ||
var tmpFilePath = path.join(tmpPath, 'file.txt') | ||
rimraf(tmpFilePath, function (err) { | ||
t.error(err) | ||
zip.unzip(zipSpacePath, tmpPath, function (err) { | ||
t.error(err) | ||
t.ok(fs.existsSync(tmpFilePath), 'extracted file should exist') | ||
var tmpFile = fs.readFileSync(tmpFilePath) | ||
var file = fs.readFileSync(filePath) | ||
t.deepEqual(tmpFile, file) | ||
}) | ||
}) | ||
}) |
var fs = require('fs') | ||
var mkdirp = require('mkdirp') | ||
var path = require('path') | ||
@@ -11,3 +10,3 @@ var rimraf = require('rimraf') | ||
mkdirp.sync(tmpPath) | ||
fs.mkdirSync(tmpPath, { recursive: true }) | ||
@@ -14,0 +13,0 @@ test('zipSync', function (t) { |
Sorry, the diff of this file is not supported yet
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
11297
2
220