Replies: 2 comments 6 replies
-
This is a repost of: https://mastodon.online/@atjn/111734301732772549 :) |
Beta Was this translation helpful? Give feedback.
0 replies
-
Can you give an example? |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I think you made a mistake by basing access on text paths. I think a better way to handle this is via objects that represent a specific path. What if I want to access the
test.txt
file in the dirfiles/
. I have to do string manipulation for that? I'd rather callDirHandle.getFile("test.txt")
and get aFileHandle
back that I can read/write to.This is not just convenience, it is a common bug that string manipulation results in paths with double slashes, missing slashes, or one slash that is the wrong type (
\
vs/
), or countless other normalization issues. Abstracting this away is IMO a service to the developer and the end user.Object-based systems also have better type safety and much better intellisense.
Another reason to go with objects, is that the new file system APIs that are being implemented in browsers are object-based. In my experience, it is easy to adapt objects to path APIs, but hard to adapt paths to object APIs, especially given that the browser APIs require user permissions to be attached to the objects.
Maybe the object-based APIs can be added on top of fsx, but that seems like unnecessary complexity to me.
Beta Was this translation helpful? Give feedback.
All reactions