@@ -72,23 +72,23 @@ Promise.resolve().then(function () {
72
72
}
73
73
}
74
74
} )
75
- . then ( ( ) => {
76
- tmpPath = findSuitableTempDirectory ( ) ;
77
- chromedriverBinaryFilePath = path . resolve ( tmpPath , chromedriverBinaryFileName ) ;
78
- } )
79
- . then ( verifyIfChromedriverIsAvailableAndHasCorrectVersion )
80
- . then ( chromedriverIsAvailable => {
81
- if ( chromedriverIsAvailable ) return ;
82
- console . log ( 'Current existing ChromeDriver binary is unavailable, proceeding with download and extraction.' ) ;
83
- return downloadFile ( ) . then ( extractDownload ) ;
84
- } )
85
- . then ( ( ) => copyIntoPlace ( tmpPath , libPath ) )
86
- . then ( fixFilePermissions )
87
- . then ( ( ) => console . log ( 'Done. ChromeDriver binary available at' , helper . path ) )
88
- . catch ( function ( err ) {
89
- console . error ( 'ChromeDriver installation failed' , err ) ;
90
- process . exit ( 1 ) ;
91
- } ) ;
75
+ . then ( ( ) => {
76
+ tmpPath = findSuitableTempDirectory ( ) ;
77
+ chromedriverBinaryFilePath = path . resolve ( tmpPath , chromedriverBinaryFileName ) ;
78
+ } )
79
+ . then ( verifyIfChromedriverIsAvailableAndHasCorrectVersion )
80
+ . then ( chromedriverIsAvailable => {
81
+ if ( chromedriverIsAvailable ) return ;
82
+ console . log ( 'Current existing ChromeDriver binary is unavailable, proceeding with download and extraction.' ) ;
83
+ return downloadFile ( ) . then ( extractDownload ) ;
84
+ } )
85
+ . then ( ( ) => copyIntoPlace ( tmpPath , libPath ) )
86
+ . then ( fixFilePermissions )
87
+ . then ( ( ) => console . log ( 'Done. ChromeDriver binary available at' , helper . path ) )
88
+ . catch ( function ( err ) {
89
+ console . error ( 'ChromeDriver installation failed' , err ) ;
90
+ process . exit ( 1 ) ;
91
+ } ) ;
92
92
93
93
function downloadFile ( ) {
94
94
if ( detect_chromedriver_version !== 'true' && configuredfilePath ) {
@@ -176,7 +176,7 @@ function findSuitableTempDirectory() {
176
176
177
177
178
178
function getRequestOptions ( downloadPath ) {
179
- const options = { uri : downloadPath , method : 'GET' } ;
179
+ const options = { uri : downloadPath , method : 'GET' } ;
180
180
const protocol = options . uri . substring ( 0 , options . uri . indexOf ( '//' ) ) ;
181
181
const proxyUrl = protocol === 'https:'
182
182
? process . env . npm_config_https_proxy
@@ -201,7 +201,7 @@ function getRequestOptions(downloadPath) {
201
201
202
202
if ( ! ca && process . env . npm_config_cafile ) {
203
203
try {
204
- ca = fs . readFileSync ( process . env . npm_config_cafile , { encoding : 'utf8' } )
204
+ ca = fs . readFileSync ( process . env . npm_config_cafile , { encoding : 'utf8' } )
205
205
. split ( / \n (? = - - - - - B E G I N C E R T I F I C A T E - - - - - ) / g) ;
206
206
207
207
// Comments at the beginning of the file result in the first
@@ -226,7 +226,7 @@ function getRequestOptions(downloadPath) {
226
226
227
227
// Use specific User-Agent
228
228
if ( process . env . npm_config_user_agent ) {
229
- options . headers = { 'User-Agent' : process . env . npm_config_user_agent } ;
229
+ options . headers = { 'User-Agent' : process . env . npm_config_user_agent } ;
230
230
}
231
231
232
232
return options ;
@@ -297,21 +297,21 @@ function extractDownload() {
297
297
298
298
function copyIntoPlace ( originPath , targetPath ) {
299
299
return del ( targetPath )
300
- . then ( function ( ) {
300
+ . then ( function ( ) {
301
301
console . log ( "Copying to target path" , targetPath ) ;
302
302
fs . mkdirSync ( targetPath ) ;
303
303
304
304
// Look for the extracted directory, so we can rename it.
305
305
const files = fs . readdirSync ( originPath ) ;
306
- const promises = files . map ( function ( name ) {
306
+ const promises = files . map ( function ( name ) {
307
307
const deferred = new Deferred ( ) ;
308
308
309
309
const file = path . join ( originPath , name ) ;
310
310
const reader = fs . createReadStream ( file ) ;
311
311
312
312
const targetFile = path . join ( targetPath , name ) ;
313
313
const writer = fs . createWriteStream ( targetFile ) ;
314
- writer . on ( "close" , function ( ) {
314
+ writer . on ( "close" , function ( ) {
315
315
deferred . resolve ( true ) ;
316
316
} ) ;
317
317
0 commit comments