* Gets file stats from a file descriptor asynchronously. * @param {number} fd The file descriptor * @param {object|Function} [options] Options or callback * @param {Function} [callback] Callback (err, stats)
(fd, options, callback)
| 880 | * @param {Function} [callback] Callback (err, stats) |
| 881 | */ |
| 882 | fstat(fd, options, callback) { |
| 883 | if (typeof options === 'function') { |
| 884 | callback = options; |
| 885 | options = undefined; |
| 886 | } |
| 887 | |
| 888 | const vfd = getVirtualFd(fd); |
| 889 | if (!vfd) { |
| 890 | process.nextTick(callback, createEBADF('fstat')); |
| 891 | return; |
| 892 | } |
| 893 | |
| 894 | vfd.entry.stat(options) |
| 895 | .then((stats) => callback(null, stats), (err) => callback(err)); |
| 896 | } |
| 897 | |
| 898 | /** |
| 899 | * Truncates a file asynchronously. |
no test coverage detected