当客户端是服务器时,用客户端 JS 读取文件结构?

Read file structure with client-JS when the client is the server?

在 google chrome 和许多其他浏览器中,您可以在本地提取网站文件(在 chrome 中,您可以使用 file:// url前缀).

如果网站是从本地文件系统加载的,是否可以通过客户端JS读取本地文件系统?或者这是不可能的时期?

Is it possible to read the local file system with client-side JS if the website was loaded from the local file system?

您可以使用filesystem: URL 方案。

Debugging the Filesystem API

filesystem: URL FTW. It’s handy to open the filesystem: URL for the root DirectoryEntry of your app’s origin. What does that mean? For example, if your app lives on www.example.com, open filesystem:http://www.example.com/temporary/ in a new tab. Chrome will show a read-only list of the files/folders stored your app origin. For more info on filesystem: URLs, see http://www.html5rocks.com/en/tutorials/file/filesystem/#toc-filesystemurls.

您还可以在 DevTools 启用 Filesystem inspection 以在 Resources -> FileSystem

查看文件夹和文件