Method description:
Close the file asynchronously.
grammar:
The code copy is as follows:
fs.close(fd, [callback(err)])
Since this method belongs to the FS module, it is necessary to introduce the FS module before use (var fs= require("fs") )
Receive parameters:
fd The file descriptor passed when the file is opened.
callback callback
example:
The code copy is as follows:
var fs = require('fs');
fs.open('/path/demo1.txt', 'a', function (err, fd) {
if (err) {
throw err;
}
fs.futimes(fd, 1388648322, 1388648322, function (err) {
if (err) {
throw err;
}
console.log('futimes complete');
fs.close(fd, function () {
console.log('Done');
});
});
});
Source code:
[code]
fs.close = function(fd, callback) {
binding.close(fd, makeCallback(callback));
};
[code]