whatwg / fs

File System Standard
https://fs.spec.whatwg.org/
Other
237 stars 20 forks source link

query access for filehandles #25

Closed jesup closed 1 year ago

jesup commented 2 years ago

The language for getting FileHandles indicates you check the 'query access' for the file using readwrite if create is true, and read if create is false. (though it also says you don't need to implement this if you don't implement any dependent specs).

a) Does this mean you can't write to a file unless you pass create: true? b) "not implementing any dependent specs" seems incredibly vague. They should be called out directly, or even better yet it should indicate under what circumstances it's needed to check the 'query access' in more concrete form, and then this rule can be applied to any current or future dependent specs.

a-sully commented 1 year ago

a) Does this mean you can't write to a file unless you pass create: true?

No. The behavior here is (to my pleasant surprise) properly specified, though within the OPFS there's no way to actually get a handle that will return anything other than "granted"

The query access algorithm for the root of the OPFS, given here, always returns "granted". Then, creating a child file or directory passes the query algorithm of the parent.

b) "not implementing any dependent specs" seems incredibly vague. They should be called out directly, or even better yet it should indicate under what circumstances it's needed to check the 'query access' in more concrete form, and then this rule can be applied to any current or future dependent specs.

I'm not seeing the "not implementing any dependent specs" language - perhaps it has since been taken out?

Closing this issue for now, but please re-open if there's more here worth discussing!