在Chrome应用程序中读取文件夹内容 [英] Read Folder Contents in Chrome Application

查看:73
本文介绍了在Chrome应用程序中读取文件夹内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,该应用程序定期输出带有数据的文本文件.文本文件从应用程序内部启动,并带有日期时间/上下文敏感名称-尽管始终输出到同一文件夹.我想编写一个chrome应用程序,该应用程序可以监视这些文件输出到的文件夹,读取它们,解析它们,然后以友好的方式显示它们.

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.

但是,似乎没有任何明显的方法可以在chrome应用程序中获取文件夹的内容.我已经阅读了有关使用NPAPI插件的建议,但看来这些建议正在逐步淘汰.NACL似乎可以做到,但我还读到它没有对文件系统的完全访问权限.

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.

这甚至可以做到吗?从打包的chrome应用程序中读取任意文件夹的内容?

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

推荐答案

阅读文档: chrome.fileSystem

Read the docs: chrome.fileSystem

Chrome Apps可以访问目录(让用户选择一次目录之后)并定期对其进行轮询.不幸的是,似乎没有基于事件的方法来监视文件夹中的更改.

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.

您应该查看HTML5上的 HTML5Rocks教程文件系统.忽略废弃的标准警告:是的,Chrome仅支持该警告,但Chrome API依赖于此,并且不会消失.

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.

这篇关于在Chrome应用程序中读取文件夹内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆