How will you truncate a file using node?



How will you truncate a file using node?..

Answer / Swati

To truncate (clear) a file in Node.js, you can use the `fs.truncate()` method:n```javascriptnfs.truncate('file_path', 0, function(err){...});```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Node.js Interview Questions

How to create a self-signed certificate in Node.js?

1 Answers  


What do you mean by “streams”? What are the different types of streams in node.js?

1 Answers  


Explain npm in node.js?

1 Answers  


what is the use of underscore in nodejs?

1 Answers  


How will you debug an application in Node.js?

1 Answers  


Who invented node?

1 Answers  


What is Tracing in Node.js?

1 Answers  


List out some repl commands in node.js?

1 Answers  


Why to use express.js?

1 Answers  


Difference between setImmediate() vs setTimeout()?

1 Answers  


Is nodejs secure?

1 Answers  


How is node js used in web development?

1 Answers  


Categories