RangerMauve / hypercore-fetch

Implementation of Fetch that uses the Hyper SDK for loading p2p content
MIT License
37 stars 13 forks source link

Display entries and prefixes with same path in directory listing #46

Closed josephmturner closed 1 year ago

josephmturner commented 1 year ago

Per #40, hypercore-fetch will allow for entries and prefixes with the same name. Currently, when both an entry and prefix exist inside of a directory, only the entry is displayed. Does it make sense to display both entries and prefixes (distinguished by a trailing slash) when both exist?

RangerMauve commented 1 year ago

Sadly, I don't think this is feasible since there's no way to detect the difference in hyperdrive-next. We'd need to attempt to do a readdir on each file or something similar to detect it which would be pretty inefficient.

If there's a better approach to detect this case, I'd love to revisit it.

Also note that filesystems don't usually support this case either.

Anyass3 commented 1 year ago

@RangerMauve do you think this will be a good solution?

https://gist.github.com/Anyass3/055cdedaa0c091bc9e11aac2a8c9ad6b