adspace
Answer Posted / Anurag Singh Chauhan
To write a file in Node.js, use the 'writeFile' function from the 'fs' module. Here's an example:n```javascriptnconst fs = require('fs');nnconst data = 'Hello World';nnfs.writeFile('output.txt', data, (err) => {n if (err) throw err;n console.log('The file has been saved!');n});n```
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers