1.

How Will You Truncate A File Using Node?

Answer»

Following is the SYNTAX of the method to truncate an opened file:
fs.ftruncate(fd, len, CALLBACK)
Parameters
Here is the description of the parameters used:
fd - This is the file descriptor returned by file fs.open() method.
len - This is the length of the file after which file will be truncated.
callback - This is the callback FUNCTION which GETS no arguments other than a possible EXCEPTION are given to the completion callback.

 

Following is the syntax of the method to truncate an opened file:
fs.ftruncate(fd, len, callback)
Parameters
Here is the description of the parameters used:
fd - This is the file descriptor returned by file fs.open() method.
len - This is the length of the file after which file will be truncated.
callback - This is the callback function which gets no arguments other than a possible exception are given to the completion callback.

 



Discussion

No Comment Found