Asha Wilma Zandra
Bob Kofi Mark
const fs = require('fs'), path1 = 'names1.txt', path2 = 'names2.txt', log = (obj) => console.log(obj.toString()); let fileContents1, fileContents2; log('starting tasks'); log(`started reading ${path1}`); fileContents1 = fs.readFileSync(path1); log(`started reading ${path2}`); fileContents2 = fs.readFileSync(path2); log('finished tasks');
> node sync
log('starting tasks'); etc.
const fs = require('fs'), path1 = 'names1.txt', path2 = 'names2.txt', log = (obj) => console.log(obj.toString()); const callbackFct1 = (err, aFileContents) => { if (err) throw err; } const callbackFct2 = (err, aFileContents) => { if (err) throw err; } fs.readFile(path1, callbackFct1); fs.readFile(path1, callbackFct2);
> node sync
log('starting tasks'); etc.