Skip to content

Commit dd48b59

Browse files
Dick WindmeijerDick Windmeijer
authored andcommitted
Merge branch 'master' of https://github.com/SNStatComp/RobotTool
2 parents 2c00893 + 416f35d commit dd48b59

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,7 @@ typings/
5959

6060
# Mac
6161
.DS_Store
62+
63+
# Application directories
64+
downloadedFiles/
65+
screenshot/

inst/server/webData.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,23 @@ var rasterize = function() {
173173
};
174174

175175
var 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

185189
var 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
});

0 commit comments

Comments
 (0)