File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -59,3 +59,7 @@ typings/
5959
6060# Mac
6161.DS_Store
62+
63+ # Application directories
64+ downloadedFiles /
65+ screenshot /
Original file line number Diff line number Diff line change @@ -173,16 +173,23 @@ var rasterize = function() {
173173} ;
174174
175175var processScreenshot = function ( url ) {
176+ if ( ! ( fs . existsSync ( './screenshot' ) ) ) {
177+ fs . mkdirSync ( './screenshot' ) ;
178+ }
179+
176180 var timeScreenshot = moment ( ) . format ( 'YYYYMMDD-HHmmss' ) ;
177181 driver . getPageSource ( ) . then ( function ( source ) {
178- fs . writeFileSync ( 'screenshot/' + timeScreenshot + 'screenshot.html' , source )
182+ fs . writeFileSync ( './ screenshot/' + timeScreenshot + 'screenshot.html' , source )
179183 } ) ;
180184 driver . takeScreenshot ( ) . then ( function ( base64png ) {
181185 fs . writeFileSync ( './screenshot/' + timeScreenshot + 'screenshot.png' , new Buffer ( base64png , 'base64' ) ) ;
182186 } ) ;
183187}
184188
185189var downloadFile = function ( observationDate , source_id , url ) {
190+ if ( ! ( fs . existsSync ( './downloadedFiles' ) ) ) {
191+ fs . mkdirSync ( './downloadedFiles' ) ;
192+ }
186193 return downloader . fromURL ( url , './downloadedFiles/' + observationDate + '-' + source_id ) . then ( function ( file ) {
187194 return hasha . fromFileSync ( file , { algorithm : 'sha256' } )
188195 } ) ;
You can’t perform that action at this time.
0 commit comments