大火导航器访问
有人知道如何使以下代码工作吗?它来自: https://web.dev/文件系统 - 系统/#访问the-origin-Provate-file-system
const root = await navigator.storage.getDirectory();
const fileHandle = await root.getFileHandle('Untitled.txt', { create: true });
最终,我试图访问我的Blazor网站创建的FIREM目录。我更喜欢原始目录,因为它不需要用户交互,并且在某种程度上受到了用户的保护。
绝对不要将其与键/对“ localstorage”功能混淆。我说的是真正的文件访问。
Anybody know how to get the following code to work? It's from: https://web.dev/file-system-access/#accessing-the-origin-private-file-system
const root = await navigator.storage.getDirectory();
const fileHandle = await root.getFileHandle('Untitled.txt', { create: true });
Ultimately I'm trying to gain access to the origin directory to store files created by my Blazor site. I prefer the origin directory because it doesn't require user interaction and is somewhat protected from the user.
Absolutely not to be confused with the key/pair 'localstorage' feature. I'm talking about genuine file access.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是创建/写作/读取简单文本文件的基本示例。
和一个现场样本: https://blazorrepl.telerrik.com/mmmkaqgpl05snj72w42w42w42w42
Here is a basic sample of creating/writing/reading a simple text file.
And a live sample: https://blazorrepl.telerik.com/mmkAQgPL05sNJ72w42
多亏了Magoo先生的答案,我才能够增加Kristoffer Strube的文件系统访问库。在他的FileSystemAccessService.cs文件中,我补充说:
然后为了演示用法,我有以下内容:
Thanks to Mister Magoo's answer, I was able to augment Kristoffer Strube's File System Access library. To his FileSystemAccessService.cs file, I added:
and then to demonstrate usage, I have the following: