方法说明: 以异步的方式关闭文件。 语法: fs.close(fd, [callback(err)]) 由于该方法属于fs模块,使用前需要引入fs模块(var fs= require(“fs”) )
方法说明:
以异步的方式关闭文件。
语法:
fs.close(fd, [callback(err)])
由于该方法属于fs模块,使用前需要引入fs模块(var fs= require(“fs”) )
接收参数:
fd 文件open时传递的文件描述符。
callback 回调
例子:
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');
});
});
});
源码:
[code]
fs.close = function(fd, callback) {
binding.close(fd, makeCallback(callback));
};
[code]
--结束END--
本文标题: node.js中的fs.close方法使用说明
本文链接: https://www.lsjlt.com/news/12079.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2022-06-04
2022-06-04
2022-06-04
2022-06-04
2022-06-04
2022-06-04
2022-06-04
2022-06-04
2022-06-04
2022-06-04
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0