New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

binwrap

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

binwrap - npm Package Compare versions

Comparing version 0.2.0-rc2 to 0.2.0

8

package.json
{
"name": "binwrap",
"version": "0.2.0-rc2",
"version": "0.2.0",
"description": "Package cross-platform binaries",

@@ -38,8 +38,8 @@ "main": "index.js",

"eslint": "^3.19.0",
"http-server": "^0.9.0",
"mocha": "^3.2.0"
"http-server": "^0.11.1",
"mocha": "^5.2.0"
},
"dependencies": {
"mustache": "^2.3.0",
"request": "^2.81.0",
"request": "^2.87.0",
"request-promise": "^4.2.0",

@@ -46,0 +46,0 @@ "tar": "^2.2.1",

@@ -33,3 +33,3 @@ [![Build Status](https://travis-ci.org/avh4/binwrap.svg?branch=master)](https://travis-ci.org/avh4/binwrap) [![npm](https://img.shields.io/npm/v/binwrap.svg)](https://www.npmjs.com/package/binwrap)

"dependencies": {
"binwrap": "^0.1.4"
"binwrap": "^0.2.0"
}

@@ -36,0 +36,0 @@ }

var request = require("request-promise");
// https://nodejs.org/api/os.html#os_os_platform
var validPlatforms = {
"aix": true,
"darwin": true,
"freebsd": true,
"linux": true,
"openbsd": true,
"sunos": true,
"win32": true,
"android": true
};
// https://nodejs.org/api/os.html#os_os_arch
var validArchs = {
"arm": true,
"arm64": true,
"ia32": true,
"mips": true,
"mipsel": true,
"ppc": true,
"ppc64": true,
"s390": true,
"s390x": true,
"x32": true,
"x64": true
};
module.exports = function test(config) {
var errors = 0;
var errors = [];
var checkedUrls = {};
var chain = Object.keys(config.urls).reduce(
function(p, buildId) {
var url = config.urls[buildId];
return p.then(function() {
return request({
method: "GET",
uri: url,
resolveWithFullResponse: true
})
.then(function(response) {
if (response.statusCode != 200) {
throw new Error("Status code " + response.statusCode);
}
console.log("OKAY: " + url);
var displayUrl = "[" + buildId + "] " + url;
var target = buildId.split("-");
if (!validPlatforms[target[0]]) {
console.log("ERROR: A URL is provided for an unknown nodejs platform: " + target[0]);
process.exit(1);
}
if (!validArchs[target[1]]) {
console.log("ERROR: A URL is provided for an unknown nodejs arch: " + target[1]);
process.exit(1);
}
if (url.slice(0,5) === "http:") {
console.log("WARNING: Binary is published at an insecure URL (using https is recommended): " + displayUrl)
}
if (checkedUrls[url]) {
return p.then(function() {
console.log("OKAY: " + displayUrl);
});
} else {
return p.then(function() {
return request({
method: "GET",
uri: url,
resolveWithFullResponse: true
})
.catch(function(err) {
console.error(" - Failed to fetch " + url + " " + err.message);
errors += 1;
});
});
.then(function(response) {
if (response.statusCode != 200) {
throw new Error("Status code " + response.statusCode);
} else {
console.log("OKAY: " + displayUrl);
}
})
.catch(function(err) {
console.error(" - Failed to fetch " + url + " " + err.message);
errors.push(displayUrl);
});
});
}
},

@@ -29,7 +80,11 @@ Promise.resolve()

return chain.then(function() {
if (errors > 0) {
var output = "There were errors when validating your published packages\n";
throw new Error(output);
if (errors.length > 0) {
console.log("There were errors when validating your published packages.");
console.log("ERROR: The following URLs (specified in your binwrap config) could not be downloaded (see details above):");
errors.forEach(function(e) {
console.log(" - " + e);
});
process.exit(1);
}
});
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc