chromedriver
Advanced tools
Comparing version 2.15.0 to 2.15.1
@@ -7,3 +7,2 @@ 'use strict' | ||
var helper = require('./lib/chromedriver') | ||
var http = require('http') | ||
var kew = require('kew') | ||
@@ -13,4 +12,4 @@ var npmconf = require('npmconf') | ||
var path = require('path') | ||
var request = require('request') | ||
var rimraf = require('rimraf').sync | ||
var url = require('url') | ||
var util = require('util') | ||
@@ -58,3 +57,3 @@ | ||
console.log('Saving to', downloadedFile) | ||
return requestBinary(getRequestOptions(conf.get('proxy')), downloadedFile) | ||
return requestBinary(downloadedFile) | ||
}) | ||
@@ -75,2 +74,3 @@ | ||
.fail(function (err) { | ||
console.error(err) | ||
console.error('ChromeDriver installation failed', err.stack) | ||
@@ -109,21 +109,3 @@ process.exit(1) | ||
function getRequestOptions(proxyUrl) { | ||
if (proxyUrl) { | ||
var options = url.parse(proxyUrl) | ||
options.path = downloadUrl | ||
options.headers = { Host: url.parse(downloadUrl).host } | ||
// Turn basic authorization into proxy-authorization. | ||
if (options.auth) { | ||
options.headers['Proxy-Authorization'] = 'Basic ' + new Buffer(options.auth).toString('base64') | ||
delete options.auth | ||
} | ||
return options | ||
} else { | ||
return url.parse(downloadUrl) | ||
} | ||
} | ||
function requestBinary(requestOptions, filePath) { | ||
function requestBinary(filePath) { | ||
var deferred = kew.defer() | ||
@@ -133,29 +115,32 @@ | ||
var notifiedCount = 0 | ||
var outFile = fs.openSync(filePath, 'w') | ||
var reportProgress = function(data) { | ||
count += data.length | ||
if ((count - notifiedCount) > 800000) { | ||
console.log('Received ' + Math.floor(count / 1024) + 'K...') | ||
notifiedCount = count | ||
} | ||
} | ||
var client = http.get(requestOptions, function (response) { | ||
var status = response.statusCode | ||
console.log('Receiving...') | ||
console.log('Receiving...') | ||
request({uri: downloadUrl, encoding: null}, function(err, response, body) { | ||
if (err) { | ||
deferred.reject('Error with http request: ' + err) | ||
return | ||
} | ||
if (status === 200) { | ||
response.addListener('data', function (data) { | ||
fs.writeSync(outFile, data, 0, data.length, null) | ||
count += data.length | ||
if ((count - notifiedCount) > 800000) { | ||
console.log('Received ' + Math.floor(count / 1024) + 'K...') | ||
notifiedCount = count | ||
} | ||
}) | ||
if (response.statusCode !== 200) { | ||
deferred.reject('Error with http request: ' + util.inspect(response.headers)) | ||
return | ||
} | ||
response.addListener('end', function () { | ||
console.log('Received ' + Math.floor(count / 1024) + 'K total.') | ||
fs.closeSync(outFile) | ||
console.log('Received ' + Math.floor(body.length / 1024) + 'K total.') | ||
fs.writeFile(filePath, body, function(err) { | ||
if (err) { | ||
deferred.reject('Error writing to file ' + filePath) | ||
} else { | ||
deferred.resolve(true) | ||
}) | ||
} | ||
}) | ||
} else { | ||
client.abort() | ||
deferred.reject('Error with http request: ' + util.inspect(response.headers)) | ||
} | ||
}) | ||
}).on('data', reportProgress) | ||
@@ -162,0 +147,0 @@ return deferred.promise |
{ | ||
"name": "chromedriver", | ||
"version": "2.15.0", | ||
"version": "2.15.1", | ||
"keywords": [ | ||
@@ -37,4 +37,5 @@ "chromedriver", | ||
"npmconf": "^2.1.1", | ||
"request": "^2.55.0", | ||
"rimraf": "^2.0.3" | ||
} | ||
} |
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
2
10273
6
176
+ Addedrequest@^2.55.0
+ Addedajv@6.12.6(transitive)
+ Addedasn1@0.2.6(transitive)
+ Addedassert-plus@1.0.0(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaws-sign2@0.7.0(transitive)
+ Addedaws4@1.13.2(transitive)
+ Addedbcrypt-pbkdf@1.0.2(transitive)
+ Addedcaseless@0.12.0(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcore-util-is@1.0.2(transitive)
+ Addeddashdash@1.14.1(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedecc-jsbn@0.1.2(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedextsprintf@1.3.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedform-data@2.3.3(transitive)
+ Addedgetpass@0.1.7(transitive)
+ Addedhar-schema@2.0.0(transitive)
+ Addedhar-validator@5.1.5(transitive)
+ Addedhttp-signature@1.2.0(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedisstream@0.1.2(transitive)
+ Addedjsbn@0.1.1(transitive)
+ Addedjson-schema@0.4.0(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedjsprim@1.4.2(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedoauth-sign@0.9.0(transitive)
+ Addedperformance-now@2.1.0(transitive)
+ Addedpsl@1.10.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedqs@6.5.3(transitive)
+ Addedrequest@2.88.2(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsshpk@1.18.0(transitive)
+ Addedtough-cookie@2.5.0(transitive)
+ Addedtunnel-agent@0.6.0(transitive)
+ Addedtweetnacl@0.14.5(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addeduuid@3.4.0(transitive)
+ Addedverror@1.10.0(transitive)