Thursday, August 28, 2014

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');

No comments:

Post a Comment