whatwg / fs

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

Origin Private File System – identification of buckets (similarly to FAS API showSaveFilePicker) #155

Closed projektorius96 closed 10 months ago

projektorius96 commented 10 months ago

What is the issue with the File System Standard?

As titled.

This is also related to my detailed question on issue:https://github.com/web-platform-tests/interop/issues/172#issuecomment-1898753770

Perhaps I am from those very few web developers that read specifications, but just to clarify: Does the specification describes means for identification of bucket(s) per origin ?

Cheers ♥

a-sully commented 10 months ago

From your response on the other issue:

Consider I have a local developer server established on localhost:5500 that I had been served files from directory A during session one (let's call it – SESS_ONE), but 5 minutes later I served different files from directory B on the same origin of localhost:5500, yet as a new session (let's call it – SESS_TWO).

My question is as follows: Does OPFS override (should I say overwrite?) the data saved during SESS_ONE the files served from directory A in favour of directory B persistence during new re-established SESS_TWO ? As far as I do understand OPFS provides a single bucket per origin, unless those buckets are IDed internally, otherwise OPFS is what says "per origin" and that specific origin should be reserved for particular directory N? Could you elaborate a bit further on, please . I tried to dig into specification, but could not find much about it. Plus we all know that depending on user-agent vendors the implementation can slightly differ. To underline, I am particularly interested in cases of Chrome / Microsoft Edge .

For starters, the spec doesn't mention "OPFS" because there may be more than one file system per origin. See https://github.com/whatwg/fs/issues/92

The question of whether or not you'll get the same file system instance in SESS_ONE and SESS_TWO has the same answer as whether or not you'll get the same IndexedDB instance. Which is a hint that you're looking in the wrong spec :)

The FS spec specifies the algorithm for getDirectory(). A local storage bottle map is obtained in Step 2. (What the heck is a Storage Bottle? See https://storage.spec.whatwg.org/#model) Where that local storage bottle map comes from is defined by the Storage spec

a-sully commented 10 months ago

Does OPFS override (should I say overwrite?) the data

Can't you inspect the data in the OPFS (say, using https://github.com/tomayac/opfs-explorer/) at the start of SESS_TWO to check whether it contains any data?

projektorius96 commented 10 months ago

Does OPFS override (should I say overwrite?) the data

Can't you inspect the data in the OPFS (say, using https://github.com/tomayac/opfs-explorer/) at the start of SESS_TWO to check whether it contains any data?

Yes, technically I can perform a use-case and see the behaviour deductively.