Skip to content

Provide a way to call the native realpath function #8715

@bpasero

Description

@bpasero
  • Version: 6.5.0
  • Platform: Mac OS X
  • Subsystem: fs

With #7899 landing, node.js is back to its old JS implementation of fs.realpath. I agree this move was necessary given the bugs. However, one feature of the native realpath function was that it would return the actual casing of a path as it is on disk, which is very useful to know.

Given a path of /foo/bar/some.txt and running fs.realpathSync(/foo/BAR/some.txt) would return /foo/bar/some.txt.

The only workaround to get the real casing of a path with node.js currently is to run fs.readdir on each segment of a path and building the path based on the results, because this function returns the actual casing as it exists on disk. Of course, such a method is not very optimal because it needs to do more work the longer the path is.

Would it be possible to get API in fs to resolve the path with the native realpath?

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.fsIssues and PRs related to the fs subsystem / file system.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions