adspace


How do you write a file using node.js?

Answer Posted / Sukhdarshan Singh

You can write to a file in Node.js using the built-in 'fs' module. Here is an example:n```javascriptnconst fs = require('fs');nfs.writeFile('myfile.txt', 'Hello World!', (err) => {n if (err) throw err;n});n```

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How we can read a file in node js?

568


Is node js losing popularity?

589