diff --git a/src/scrape.js b/src/scrape.js index 1fe6212..910f7cd 100644 --- a/src/scrape.js +++ b/src/scrape.js @@ -177,10 +177,12 @@ const { page_ids, output, events: event_file } = parse_args( const read_previous_events = (path) => { if (path !== null) { - return fs - .readFile(path, { encoding: 'utf-8' }) - .then((content) => JSON.parse(content)) - .catch(console.error); + if (filesystem.existsSync(path)) { + return fs + .readFile(path, { encoding: 'utf-8' }) + .then((content) => JSON.parse(content)) + .catch(console.error); + } } return Promise.resolve([]); };