Node.js filehandle.close() Method
The filehandle.close() method is used to asynchronously close the given file descriptor thereby clearing the file that is associated with it. This will allow the file descriptor to be reused for other files.
Calling filehandle.close() method on a file descriptor while some other operation is being performed on it may lead to undefined behavior.
Parameters: This method does not accept any parameters.
Example: This example represents the opening of a file and to close the file descriptor.
Note: The “input.txt” should be present in the directory with the following text:
Greetings from GeeksforGeeks
Run app.js file using the following command:
Greetings from GeeksforGeeks File Closed!
My Personal Notes arrow_drop_up
Please Login to comment...