fsPromises.realpath(path[, options])
使用与 fs.realpath.native()
函数相同的语义确定 path
的实际位置。
¥Determines the actual location of path
using the same semantics as the
fs.realpath.native()
function.
仅支持可以转换为 UTF8 字符串的路径。
¥Only paths that can be converted to UTF8 strings are supported.
可选的 options
参数可以是指定编码的字符串,也可以是具有 encoding
属性(指定用于路径的字符编码)的对象。如果 encoding
设置为 'buffer'
,则返回的路径将作为 <Buffer> 对象传入。
¥The optional options
argument can be a string specifying an encoding, or an
object with an encoding
property specifying the character encoding to use for
the path. If the encoding
is set to 'buffer'
, the path returned will be
passed as a <Buffer> object.
在 Linux 上,将 Node.js 与 musl libc 链接时,必须将 procfs 文件系统挂载在 /proc
上,此函数才能起作用。Glibc 没有此限制。
¥On Linux, when Node.js is linked against musl libc, the procfs file system must
be mounted on /proc
in order for this function to work. Glibc does not have
this restriction.