1
- var fs = require ( 'fs' )
2
- var path = require ( 'path' )
3
- var electronDownload = require ( 'electron-download' )
4
- var extractZip = require ( 'extract-zip' )
5
- var versionToDownload = require ( './package' ) . version
1
+ const fs = require ( 'fs' )
2
+ const path = require ( 'path' )
3
+ const electronDownload = require ( 'electron-download' )
4
+ const extractZip = require ( 'extract-zip' )
5
+ const versionToDownload = require ( './package' ) . version
6
6
7
7
function download ( version , callback ) {
8
8
electronDownload ( {
9
- version : version ,
9
+ version,
10
10
chromedriver : true ,
11
11
platform : process . env . npm_config_platform ,
12
12
arch : process . env . npm_config_arch ,
@@ -17,20 +17,20 @@ function download (version, callback) {
17
17
18
18
function processDownload ( err , zipPath ) {
19
19
if ( err != null ) throw err
20
- extractZip ( zipPath , { dir : path . join ( __dirname , 'bin' ) } , function ( error ) {
20
+ extractZip ( zipPath , { dir : path . join ( __dirname , 'bin' ) } , error => {
21
21
if ( error != null ) throw error
22
22
if ( process . platform !== 'win32' ) {
23
- fs . chmod ( path . join ( __dirname , 'bin' , 'chromedriver' ) , '755' , function ( error ) {
23
+ fs . chmod ( path . join ( __dirname , 'bin' , 'chromedriver' ) , '755' , error => {
24
24
if ( error != null ) throw error
25
25
} )
26
26
}
27
27
} )
28
28
}
29
29
30
- download ( versionToDownload , function ( err , zipPath ) {
30
+ download ( versionToDownload , ( err , zipPath ) => {
31
31
if ( err ) {
32
- var versionSegments = versionToDownload . split ( '.' )
33
- var baseVersion = versionSegments [ 0 ] + '.' + versionSegments [ 1 ] + '.0'
32
+ const parts = versionToDownload . split ( '.' )
33
+ const baseVersion = ` ${ parts [ 0 ] } . ${ parts [ 1 ] } .0`
34
34
download ( baseVersion , processDownload )
35
35
} else {
36
36
processDownload ( err , zipPath )
0 commit comments