@@ -20,29 +20,25 @@ const repo = github.client().repo('nodejs/evangelism')
2020function checkOrFetchFile ( file ) {
2121 const filePath = path . join ( basePath , file . name )
2222
23- fs . access ( filePath , function ( err ) {
23+ fs . access ( filePath , ( err ) => {
2424 if ( ! err ) {
2525 console . log ( `Weekly Update ${ filePath } exists. (No SHA check, yet.)` )
2626 return
2727 }
2828
2929 console . log ( `Weekly Update ${ filePath } does not exist. Downloading.` )
3030
31- https . get ( file . download_url , function ( response ) {
32- console . log ( `Weekly Update ${ filePath } downloaded.` )
33-
31+ https . get ( file . download_url , ( response ) => {
3432 const ws = fs . createWriteStream ( filePath )
35- ws . on ( 'error' , function ( err ) {
36- console . error ( err . stack )
37- } )
33+ ws . on ( 'error' , ( err ) => console . error ( err . stack ) )
34+
35+ response . on ( 'end' , ( ) => console . log ( `Weekly Update ${ filePath } downloaded.` ) )
3836 response . pipe ( ws )
39- } ) . on ( 'error' , function ( err ) {
40- console . error ( err . stack )
41- } )
37+ } ) . on ( 'error' , ( err ) => console . error ( err . stack ) )
4238 } )
4339}
4440
45- repo . contents ( 'weekly-updates' , function ( err , files ) {
41+ repo . contents ( 'weekly-updates' , ( err , files ) => {
4642 if ( err ) { throw err }
4743 files . forEach ( checkOrFetchFile )
4844} )
0 commit comments