从fd获取文件path/名称

我有一个方法来处理fs.write操作导致的所有错误。 该方法有一个arg,即发生错误的文件的fd。

有没有一种方法可以使用提供的fd检索文件path/名称?

即:

handleWriteError: function (fd, err) { // fetch the path/name using the fd, then: console.log('Error occurred writing to %s/%s', path, name); } 

使用节点v0.12

文件描述符是用于访问文件或其他input/输出资源(通常是非负整数)的抽象指示符。 因此,您无法从描述符对象获取文件path或名称。

例:

 fs = require("fs"); fd = fs.openSync("readme.txt", "a"); console.dir(fd); // 10