fs.realpath.native(path[, options], callback)


异步实路径(3)。

【Asynchronous realpath(3).】

callback 接受两个参数 (err, resolvedPath)

【The callback gets two arguments (err, resolvedPath).】

仅支持可以转换为 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 passed to the callback. 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.】