file write sync and async in nodejs



var fs = require('fs');
var data= 'heloo world';

fs.writeFile('filename.txt', data, 'utf-8', function(error){
console.log('write file async');
});

fs.writeFile('filenameSync.txt', data, 'utf-8');
console.log('write file sync');

Comments

Popular posts from this blog

Project euler 169 found clue

Floyd-Warshall's algorithm