Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to obtain case-exact path of a file in Node.js on Windows?

I have a path, let's say C:\temp\something.js and I want to get case-exact version of the path on Windows - so if there is C:\Temp\someThing.js stored on disk, I would like to get this value (path).

How can I get from the former path the later one in Node.js?

I have already gone through FS API (https://nodejs.org/api/fs.html) and I have not found anything useful (namely fs.realpathSync, fs.statSync, fs.accessSync did not return what I need).

like image 272
Martin Vseticka Avatar asked Oct 12 '15 17:10

Martin Vseticka


1 Answers

As of Node 9, fs.realpathSync.native appears to do the trick.

like image 164
Piotr Avatar answered Sep 20 '22 13:09

Piotr