bcpeinhardt / simplifile

Simple file operations for Gleam that work on all targets (Erlang/Node/Deno)
76 stars 9 forks source link

Expose `lstat` / `read_link_info` #34

Closed joshi-monster closed 2 weeks ago

joshi-monster commented 2 weeks ago

Hi!

currently there is no way to get the stat object for a symbolic link, outside of knowning that something is a symlink by using is_symlink.

Hayleigh suggested that I use simplifile for my file watcher library, but unfortunately, I would also need to have access to the last modified timestamp / other stat data for the symlink itself, not just the target it points to.

Would this be something you'd consider adding? Thanks, ~yoshi

bcpeinhardt commented 2 weeks ago

Hmmm. The file_info function returns a FileInfo object which includes the last modified time (mtime_seconds since the unix epoch iirc). What other info were you looking for? We do a custom object because different info is available in different shapes on node vs deno vs bun vs erlang.

Edit: I get it now we're using stat not lstat and you need info about the link not the target. Yeah more utils than is_simlink should definitely be added.