# Below is the code to write data into file
/**
* Created by Anand Dwivedi on 8/26/2016.
*/
var file = require('fs');
var data =file.writeFile('File2','Hello my Name is \n Anand','utf8',function (error) {
if(error)console.log('Error while writing into file');
console.log('sucessfully writeen');
});
and Best Way is
/**
* Created by Anand Dwivedi on 8/26/2016.
*/
var file = require('fs');
var data =file.writeFileSync('File2','Hello my Name is \n anand','utf8');
console.log('sucessfully writeen');
#Make sure that you are responsible to create file with the name File2
/**
* Created by Anand Dwivedi on 8/26/2016.
*/
var file = require('fs');
var data =file.writeFile('File2','Hello my Name is \n Anand','utf8',function (error) {
if(error)console.log('Error while writing into file');
console.log('sucessfully writeen');
});
and Best Way is
/**
* Created by Anand Dwivedi on 8/26/2016.
*/
var file = require('fs');
var data =file.writeFileSync('File2','Hello my Name is \n anand','utf8');
console.log('sucessfully writeen');
#Make sure that you are responsible to create file with the name File2
No comments:
Post a Comment