Open In App

Web technologies Questions | Node.js Quiz | Set-1 | Question 5

Like Article
Like
Save
Share
Report

Which of the below fs module is used to truncate a file ?
(A) fs.delete(fd, len, callback)
(B) fs.remove(fd, len, callback)
(C) fs.ftruncate(fd, len, callback)
(D) None of the above.


Answer: (C)

Explanation: The fs.ftruncate() method in Node.js is used to change the size of the files It increases or decreases the size of the file. Or it changes the length of the file by len bytes If len is shorter than the file’s current length, the file is truncated to that length. It takes 3 parameters as fd, len, and callback.

Quiz of this Question
Please comment below if you find anything wrong in the above post


Last Updated : 30 Sep, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads