问HN:谁在使用Origin私有文件系统?
我觉得 OPFS [0] 真是太棒了。(对于不太了解的人来说:每个网站都有一个只有它可以访问的目录,并且可以以接近本地速度读写该目录。)Adobe 在其网页版本的 Photoshop 中使用它,以便处理无法放入浏览器内存中的文件 [1]。
我非常喜欢它。我有一种冲动,想把它用于我不使用 localStorage 的所有事情。我第一次使用它是在编写一个浏览器内的矢量数据库时,它几乎是完美的。(我非常喜欢它,以至于为它编写了一个抽象层,这样我就可以一次编写代码,并在浏览器或内存中原生运行。)OPFS 可以从 Web Worker 中使用,并且有一个很好的异步 API。但我很少听到其他人提起它。如果大多数网页开发者不知道它的存在,我也不会感到惊讶。因此,我想在这里问问,看是否还有其他人在使用它。
[0]: https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system
[1]: https://developer.chrome.com/blog/how-photoshop-solved-working-with-files-larger-than-can-fit-into-memory
查看原文
I think the OPFS [0] is just awesome. (For the uninitiated: each website gets a directory that only it can access, and it can write to & read from that directory at near-native speed.) Adobe uses it for the web-version of photoshop, to allow it to work with files that can't fit in browser memory [1].<p>I love it. I have the impulse to use it for basically everything that I don't use localStorage for. I first used it when writing an in-browser vector database, for which it was pretty much perfect. (I liked it so much I wrote an abstraction layer for it so I could write code once and have it work natively, in the browser, or in memory.) OPFS can be used from web workers and has a nice async API. But I very rarely hear anyone else talking about it. I wouldn't be surprised if most web devs don't know it exists. So I thought I'd ask here to see if anyone else is using it.<p>[0]: https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system<p>[1]: https://developer.chrome.com/blog/how-photoshop-solved-working-with-files-larger-than-can-fit-into-memory