Comparing version 1.0.0 to 1.1.0
@@ -8,4 +8,7 @@ var path = require("path"); | ||
function binstall(url, tarArgs, options) { | ||
var verbose = typeof options === "object" && options.verbose; | ||
options = options || {}; | ||
var verbose = options.verbose; | ||
var verify = options.verify; | ||
return new Promise(function(resolve, reject) { | ||
@@ -17,3 +20,11 @@ var untar = tar.Extract(tarArgs) | ||
.on("end", function() { | ||
resolve("Successfully downloaded and processed " + url); | ||
var successMessage = "Successfully downloaded and processed " + url; | ||
if (verify) { | ||
verifyContents(verify).then(function() { | ||
resolve(successMessage); | ||
}).catch(reject); | ||
} else { | ||
resolve(successMessage); | ||
} | ||
}); | ||
@@ -47,2 +58,20 @@ | ||
function verifyContents(files) { | ||
return Promise.all( | ||
files.map(function(filePath) { | ||
return new Promise(function(resolve, reject) { | ||
fs.stat(filePath, function(err, stats) { | ||
if (err) { | ||
reject(filePath + " was not found."); | ||
} else if (!stats.isFile()) { | ||
reject(filePath + " was not a file."); | ||
} else { | ||
resolve(); | ||
} | ||
}); | ||
}); | ||
}) | ||
); | ||
} | ||
module.exports = binstall; |
{ | ||
"name": "binstall", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Install binaries via npm.", | ||
@@ -5,0 +5,0 @@ "main": "binstall.js", |
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
4918
64