Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chromedriver

Package Overview
Dependencies
Maintainers
1
Versions
223
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chromedriver - npm Package Compare versions

Comparing version 2.15.0 to 2.15.1

73

install.js

@@ -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"
}
}
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