Read Folder Contents in Chrome Application

房东的猫 提交于 2019-12-12 03:23:42

问题


I have an application which outputs text files periodically with data in it. The text files are initiated from within the application and a datetime/context sensitive name -- though always output to the same folder. I would like to write a chrome application that can watch the folder these files are output to, read them, parse them, and then display them in a friendly manner.

However, there does not seem to be any obvious way to get the contents of a folder in a chrome app. I've read suggestions to use an NPAPI plugin, but it appears those are being phased out. NACL seems like it might do it but I've also read that it doesn't have full access to the file-system.

Is this something that can even be done? Reading the contents of an arbitrary folder from a packaged chrome application?


回答1:


Read the docs: chrome.fileSystem

Chrome Apps can access a directory (after getting the user to select it once) and periodically poll it. Unfortunately, there seems to be no event-based approach to watch a folder for changes.

You should check out the HTML5Rocks tutorial on HTML5 Filesystems. Ignore the abandoned standard warning: yes, it's only supported in Chrome, but Chrome APIs rely on it and it's not going away.



来源:https://stackoverflow.com/questions/28245931/read-folder-contents-in-chrome-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!