use writeFileSync

Thanks @thisandagain!
This commit is contained in:
Matthew Taylor 2017-11-16 09:58:08 -05:00
parent b584bb80e7
commit 2dd82e858e

View file

@ -36,9 +36,7 @@ https.get('https://resources.scratch.mit.edu/localized-urls.json', (res) => {
res.on('end', () => { res.on('end', () => {
try { try {
var urlJson = JSON.parse(urlData); var urlJson = JSON.parse(urlData);
fs.writeFile(filename, JSON.stringify(urlJson, null, ' '), (err) => { fs.writeFileSync(filename, JSON.stringify(urlJson, null, ' '));
if (err) process.stdout.write(`Failed writing file: ${err.message}\n`);
});
} catch (e) { } catch (e) {
process.stdout.write(`Failed parsing url data: ${e.message}\n`); process.stdout.write(`Failed parsing url data: ${e.message}\n`);
process.exit(1); process.exit(1);