jscrambler
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -128,3 +128,4 @@ 'use strict'; | ||
access_key: this.options.accessKey, | ||
timestamp: new Date().toISOString() | ||
timestamp: new Date().toISOString(), | ||
user_agent: 'Node' | ||
}); | ||
@@ -131,0 +132,0 @@ if (method === 'POST' && params.files) handleFileParams(params); |
@@ -213,21 +213,32 @@ /** | ||
zipProject: function (files) { | ||
var zip = new JSZip(); | ||
for (var i = 0, l = files.length; i < l; ++i) { | ||
var buffer, name; | ||
if (files[i].contents) { | ||
name = path.relative(files[i].cwd, files[i].path); | ||
buffer = files[i].contents; | ||
} else if (!fs.statSync(files[i]).isDirectory()) { | ||
name = files[i]; | ||
buffer = fs.readFileSync(files[i]); | ||
var hasFiles = false; | ||
if (files.length === 1 && /^.*\.zip$/.test(files[0])) { | ||
hasFiles = true; | ||
fs.outputFileSync('.tmp.zip', fs.readFileSync(files[0])); | ||
} else { | ||
var zip = new JSZip(); | ||
for (var i = 0, l = files.length; i < l; ++i) { | ||
var buffer, name; | ||
if (files[i].contents) { | ||
name = path.relative(files[i].cwd, files[i].path); | ||
buffer = files[i].contents; | ||
} else if (!fs.statSync(files[i]).isDirectory()) { | ||
name = files[i]; | ||
buffer = fs.readFileSync(files[i]); | ||
} else { | ||
zip.folder(files[i]); | ||
} | ||
if (name) { | ||
hasFiles = true; | ||
zip.file(name, buffer); | ||
} | ||
} | ||
if (hasFiles) { | ||
fs.outputFileSync('.tmp.zip', zip.generate({type: 'nodebuffer'}), {encoding: 'base64'}); | ||
files[0] = '.tmp.zip'; | ||
files.length = 1; | ||
} else { | ||
zip.folder(files[i]); | ||
throw new Error('No source files found. If you intend to send a whole directory sufix your path with "**" (e.g. ./my-directory/**)'); | ||
} | ||
if (name) { | ||
zip.file(name, buffer); | ||
} | ||
} | ||
fs.outputFileSync('.tmp.zip', zip.generate({type: 'nodebuffer'}), {encoding: 'base64'}); | ||
files[0] = '.tmp.zip'; | ||
files.length = 1; | ||
}, | ||
@@ -234,0 +245,0 @@ /** |
{ | ||
"name": "jscrambler", | ||
"description": "JScrambler API client.", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"homepage": "https://github.com/auditmark/node-jscrambler", | ||
@@ -32,4 +32,4 @@ "author": { | ||
"fs-extra": "^0.8.1", | ||
"jszip": "^2.2.0", | ||
"glob": "^3.2.9" | ||
"jszip": "^2.2.2", | ||
"glob": "^3.2.11" | ||
}, | ||
@@ -36,0 +36,0 @@ "main": "jscrambler", |
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
24795
445
Updatedglob@^3.2.11
Updatedjszip@^2.2.2