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', () => {
try {
var urlJson = JSON.parse(urlData);
fs.writeFile(filename, JSON.stringify(urlJson, null, ' '), (err) => {
if (err) process.stdout.write(`Failed writing file: ${err.message}\n`);
});
fs.writeFileSync(filename, JSON.stringify(urlJson, null, ' '));
} catch (e) {
process.stdout.write(`Failed parsing url data: ${e.message}\n`);
process.exit(1);