Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to call the native realpath function #8715

Closed
bpasero opened this issue Sep 22, 2016 · 2 comments
Closed

Provide a way to call the native realpath function #8715

bpasero opened this issue Sep 22, 2016 · 2 comments
Labels
feature request Issues that request new features to be added to Node.js. fs Issues and PRs related to the fs subsystem / file system.

Comments

@bpasero
Copy link
Contributor

bpasero commented Sep 22, 2016

  • 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?

@mscdex mscdex added fs Issues and PRs related to the fs subsystem / file system. feature request Issues that request new features to be added to Node.js. labels Sep 22, 2016
@Trott
Copy link
Member

Trott commented May 27, 2017

@nodejs/fs

@bnoordhuis
Copy link
Member

#15776

bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue Nov 9, 2017
Make the `uv_fs_realpath()` binding (which calls the libc `realpath()`
on UNIX and `GetFinalPathNameByHandle()` on Windows) available as the
`fs.realpath.native()` and `fs.realpathSync.native()` functions.

The binding was already available as `process.binding('fs').realpath`
but was not exposed or tested - and partly broken as a result.

Fixes: nodejs#8715
PR-URL: nodejs#15776
Refs: nodejs#7899
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
Reviewed-By: Trevor Norris <[email protected]>
evanlucas pushed a commit that referenced this issue Nov 13, 2017
Make the `uv_fs_realpath()` binding (which calls the libc `realpath()`
on UNIX and `GetFinalPathNameByHandle()` on Windows) available as the
`fs.realpath.native()` and `fs.realpathSync.native()` functions.

The binding was already available as `process.binding('fs').realpath`
but was not exposed or tested - and partly broken as a result.

Fixes: #8715
PR-URL: #15776
Refs: #7899
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
Reviewed-By: Trevor Norris <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

No branches or pull requests

4 participants