```window.showDirectoryPicker``` 开辟了一个全新的世界
window.showDirectoryPicker opens up a whole new world

原始链接: https://steveharrison.dev/showdirectorypicker-opens-up-a-whole-new-world/

Chrome 的 `window.showDirectoryPicker()` API 正在改变基于浏览器的应用程序,它允许网站直接在用户的本地计算机上读写文件。这种“本地优先”的方法使强大的工具(如照片管理器和基于节点的合成器)能够在浏览器中运行,同时将数据安全地存储在用户的文件系统中,而非云端服务器上。 作者通过使用 Claude 生成复杂的原型展示了这一潜力,包括受 Aperture 启发的照片管理器和 Shake 风格的合成应用程序,整个过程无需手动编码。通过将基于浏览器的 UI 灵活性与本地存储相结合,开发者可以创建精密的创意套件(如视频或照片编辑器),在提供桌面软件强大功能的同时,兼具 Web 的易用性。这一转变预示着一个充满希望的未来:高性能创意工具将在本地运行,赋予用户对其数据的完全所有权和控制权。

最近的一场 Hacker News 讨论强调了 `window.showDirectoryPicker` API 的潜力,该 API 使 Web 应用程序能够直接访问本地文件系统。 支持者认为,这一功能是“本地优先”Web 开发的转折点,能有效地将用户现有的文件系统或云存储转化为无缝的同步引擎。通过消除对定制同步基础设施的需求,它简化了构建强大客户端工具的过程。 然而,讨论也揭示了显著的实际障碍。开发人员报告了令人沮丧的权限问题,特别是在使用 VSCode 内置浏览器等集成环境时。此外,该功能还面临兼容性方面的批评;尽管一些人建议使用 `webkitdirectory` 等旧替代方案来提供类似功能,但其他人对 Firefox 持续不支持该 API 表示强烈不满,并将此与该浏览器历史上对 WebUSB 等其他硬件访问标准的一贯抵制相提并论。
相关文章

原文

Chrome introduced a new API, window.showDirectoryPicker() that allows the user to grant access to a directory on their computer and allow a website to read/write everything inside.

Examples that have been thrown around are a local-first notes app, where you can grant it access to a folder full of Markdown notes, and you own the data rather than it being squirrelled away in some cloud service.

The other day I was getting nostalgic about Apple’s Aperture UI and wondered whether Claude could create a similarly-themed UI. I asked it to also use window.showDirectoryPicker.

Here’s the result:

联系我们 contact @ memedata.com