Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Web][Feature request][OPFS] Please add "Origin-private filesystem" support, allowing native DBs on the web #51781

Closed
gintominto5329 opened this issue Mar 19, 2023 · 7 comments
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. web-libraries Issues impacting dart:html, etc., libraries

Comments

@gintominto5329
Copy link

hello,

Currently, the recommended client-side persistence/storage solution, on web, is IndexedDB, but its API is quite-bad, I never found anyone using it directly, without abstractions,

So a new solution has been released by the web-sters, called "Origin-private FileSystem", which has support in all the browsers, except "Samsung Internet"(mobile), and "Internet Explorer"(desktop), even the slow-mover Safari supports it,

It allows the code(js/wasm), to access a filesystem-like, persistent, high-performance, and origin-private, storage medium,

  • Permission prompts are not required to access files in the OPFS,
  • The OPFS is subject to browser quota restrictions, just like IndexedDB,
  • Clearing data for the site deletes the OPFS,

It just behaves as a filesystem, with files and directories, etc; but the implementation is vendor dependent, maybe inside another database, but the user gets a posix-inspired, sync, as well as async, filesystem-like API,

The performance capabilities of OPFS can be sensed from the fact that, it was originally developed to provide the persistence capabilities to sqlite.wasm, on the web, the same globally known embedded-database,

Specification is available at spec.whatwg.org

thanks,

@lrhn lrhn added the area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. label Mar 19, 2023
@kevmoo
Copy link
Member

kevmoo commented Mar 19, 2023

Hello @gintominto5329 – where exactly do you want support added? in dart:html?

@gintominto5329
Copy link
Author

gintominto5329 commented Mar 20, 2023

Hello @gintominto5329 – where exactly do you want support added? in dart:html?

Yes sir,

dart:html should be the correct place,

Because it already has other FileSystem(and "OPFS")-related classes, like

thanks,

@anlumo
Copy link

anlumo commented Mar 21, 2023

Note that the sync API is only supported in Web Workers, and Flutter does not support Web Workers.

@nshahan nshahan added the web-libraries Issues impacting dart:html, etc., libraries label Mar 21, 2023
@gintominto5329
Copy link
Author

gintominto5329 commented Mar 22, 2023

Note that the sync API is only supported in Web Workers, and Flutter does not support Web Workers.

IndexedDB docs, also have a note like "This feature is available in Web Workers",

maybe js-side abstraction, could be an answer here

@gintominto5329
Copy link
Author

Any updates?
thanks

@kevmoo
Copy link
Member

kevmoo commented Aug 10, 2023

See https://github.com/dart-lang/web/blob/main/lib/src/dom/fs.dart

We're going to be moving all of our support to this package in the future. Improvements to dart:html and friends will likely be limited to critical bugs and blockers.

@kevmoo kevmoo closed this as completed Aug 10, 2023
@gintominto5329
Copy link
Author

gintominto5329 commented Aug 11, 2023

See https://github.com/dart-lang/web/blob/main/lib/src/dom/fs.dart

We're going to be moving all of our support to this package in the future. Improvements to dart:html and friends will likely be limited to critical bugs and blockers.

I checked out package:web, but it was published 8 years ago.

So when, and how, could we use the new package.

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. web-libraries Issues impacting dart:html, etc., libraries
Projects
None yet
Development

No branches or pull requests

5 participants