Skip to content

Implement realpath.native #1116

@streamich

Description

@streamich

Add support of realpath.native to memfs. See Node.js documentation:

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

History   |   -- | --   |     |  

Asynchronous realpath(3).

The callback gets two arguments (err, resolvedPath).

Only paths that can be converted to UTF8 strings are supported.

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.

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.

fs.realpath.native(path[, options], callback)[#](https://nodejs.org/api/fs.html#fsrealpathnativepath-options-callback) History path [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://nodejs.org/api/buffer.html#class-buffer) | [](https://nodejs.org/api/url.html#the-whatwg-url-api) options [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) encoding [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) Default: 'utf8' callback [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) err [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) resolvedPath [](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [](https://nodejs.org/api/buffer.html#class-buffer) Asynchronous [realpath(3)](http://man7.org/linux/man-pages/man3/realpath.3.html).

The callback gets two arguments (err, resolvedPath).

Only paths that can be converted to UTF8 strings are supported.

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 object.

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.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions