Closed AisonSu closed 1 year ago
This took me a while to track down. I'm guessing you're browsing the code, not just relying on IDE autocomplete, because There is no Fs.stat()
binding. What we have is Fs.Filehandle.stat()
:
https://nodejs.org/api/fs.html#filehandlestatoptions
https://github.com/TheSpyder/rescript-nodejs/blob/f20b20744cf66440b4f4cc2983838ebaff8995bd/src/Fs.res#L267-L297
The Fs.lstat()
binding is as you say, with an additional variant for the bigint return:
https://nodejs.org/api/fs.html#fspromiseslstatpath-options
https://github.com/TheSpyder/rescript-nodejs/blob/f20b20744cf66440b4f4cc2983838ebaff8995bd/src/Fs.res#L374-L378
I can only speculate about why the original maintainers wrote it this way, it's been there since the first commit. If you think it is necessary to have both Fs.lstat()
and Fs.atat()
feel free to submit a PR :)
According to Nodejs Document:
lstat() is identical to stat(), except that if path is a symbolic link, then the link itself is stat-ed, not the file that it refers to
,The signatures should be same, But actually it isstring => Js.Promise.t<Stats.t> = "lstat"
for lstat andFileHandle.t => Js.Promise.t<Stats.t> = "stat"
for stat