How we can open a file in node js?



How we can open a file in node js?..

Answer / Vinay Pratap Singh Chauhan

To read a file in Node.js, you can use the built-in 'fs' module. Here is an example: `const fs = require('fs'); fs.readFile('filename', 'utf8', (err, data) => { if (err) throw err; console.log(data); });`

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Node.js Interview Questions

What are the types of applications that can be built by using Node.js?

1 Answers  


What types of tasks can be done asynchronously using the event loop?

1 Answers  


How can we avoid Callback Hell in Node.js?

1 Answers  


What are the global installations of dependencies?

1 Answers  


How prevents blocking code in node.js?

1 Answers  


How does nodejs single threaded work?

1 Answers  


How to generate unique uuids/ guid in node js?

1 Answers  


How to concatenate buffers in NodeJS?

1 Answers  


Why is the importance of a consistent style? What tools can help you assure a consistent style?

1 Answers  


Which module is used for web based operations in node.js?

1 Answers  


What is a control flow function? What are the steps does it execute?

1 Answers  


How to uninstall the dependency using npm?

1 Answers  


Categories