Last Updated: February 25, 2016
·
2.753K
· alfred-nsh

Get path of a file descriptor in linux in node.js

/proc/self/fd/<fd> is a symlink to it's file. You can use fs.readlink to get it's path:

> fs.openSync('.', 'r')
10
> fs.readlinkSync('/proc/self/fd/10')
'/home/alfred/repos/test