Writing the file using file system module. we have two options to process synchronous and asynchronous. Here we are testing on synchronous of the node.js. The sequence of code should wait until we write the sample txt file. For that waiting we are using writeFileSync class from File system module.
var file = require("fs");
console.log("Starting...");
var contents = file.writeFileSync("./write_file.txt", "Text to Write");
console.log(" done ...");
Here we are testing on asynchronous of the node.js. The sequence of code should not wait until we read the sample txt file. For that we are using callback function.
var file = require("fs");
console.log("Starting...");
var contents = file.writeFile("./write_file.txt", "Text to Write",
function(error){
console.log("written file");
}
);
console.log(" done ...");
Re:
ReplyDelete"The sequence of code should not wait until we read the sample txt file."
Read?? or Write?
great
ReplyDeleteThanks for sharing this information. Its really useful detail about Nodejs. Nodejs Training in Bangalore
ReplyDeleteThis is a nice and informative, containing all information and also has a great impact on the new technology.
ReplyDeletenode.js development company
Very nice post here and thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.
ReplyDeletebest rpa training in bangalore
rpa training in bangalore | rpa course in bangalore
RPA training in bangalore
rpa training in chennai
rpa online training
Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts
ReplyDeletepython Training institute in Pune
python Training institute in Chennai
python Training institute in Bangalore
Outstanding blog post, I have marked your site so ideally I’ll see much more on this subject in the foreseeable future.
ReplyDeleteData Science course in rajaji nagar
Data Science with Python course in chenni
Data Science course in electronic city
Data Science course in USA
Data science course in pune | Data Science Training institute in Pune
Data science course in bangalore
The knowledge of technology you have been sharing thorough this post is very much helpful to develop new idea. here by i also want to share this.
ReplyDeleteAWS Training in Bangalore
AWS Training in pune
Enjoyed reading the article above, really explains everything in detail, the article is very interesting and effective. Thank you and good luck for the upcoming articles learn Node JS training
ReplyDeleteI had a wonderful time reading your article. Thank you
ReplyDeleteNode JS Online training
Node JS training in Hyderabad
Useful article. Thanks for sharing this useful articles with us.
ReplyDeleteArtificial Intelligence training institute in Bangalore
Artificial Intelligence training institute in India
Artificial Intelligence training course
Artificial Intelligence course fee in Bangalore
Nice article I was impressed by seeing this blog, it was very interesting and it is Thanks for sharing all the information with us all.very useful for meThank you for sharing any good knowledge and thanks for fantastic efforts. Really the post is very unique.every concepts are captured nice.
ReplyDeleteoracle training in chennai
oracle training institute in chennai
oracle training in bangalore
oracle training in hyderabad
oracle training
hadoop training in chennai
hadoop training in bangalore