@saucelabs/bin-wrapper
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -13,2 +13,3 @@ "use strict"; | ||
const tar_1 = __importDefault(require("./archive/tar")); | ||
const https_proxy_agent_1 = require("https-proxy-agent"); | ||
async function downloadAndUnpack(url, filepath, binary, options = {}) { | ||
@@ -24,7 +25,22 @@ const payload = await download(url, options); | ||
exports.downloadAndUnpack = downloadAndUnpack; | ||
function getHttpsProxyValue() { | ||
for (const k of Object.keys(process.env)) { | ||
if (k.toUpperCase() === "HTTPS_PROXY") { | ||
return process.env[k]; | ||
} | ||
} | ||
return undefined; | ||
} | ||
async function download(url, options) { | ||
return await axios_1.default.get(url.toString(), { | ||
const opts = { | ||
headers: options.headers, | ||
responseType: 'arraybuffer', | ||
headers: options.headers, | ||
}).then((res) => { | ||
}; | ||
const httpsProxy = getHttpsProxyValue(); | ||
if (httpsProxy && url.protocol === 'https:') { | ||
opts.httpsAgent = new https_proxy_agent_1.HttpsProxyAgent(httpsProxy); | ||
// Disable axios' native proxy, because we are letting HttpsProxyAgent handle it. | ||
opts.proxy = false; | ||
} | ||
return await axios_1.default.get(url.toString(), opts).then((res) => { | ||
return res.data; | ||
@@ -31,0 +47,0 @@ }).catch((err) => { |
{ | ||
"name": "@saucelabs/bin-wrapper", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Fetches and runs a binary", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances 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
30278
326
4
2