Chrome扩展程序包含文本文件 [英] Chrome extensions with text files
本文介绍了Chrome扩展程序包含文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Chrome扩展的新手,我需要开发一个可以处理文本/ json文件的chrome扩展(应该能够执行读写操作)。文件将存储在同一台机器上(路径可能是D: /abc/xyz.text)在这里我将安装Chrome扩展。有没有人有任何想法?
解决方案
不容易或完全不可能 - Chrome扩展程序无法获得真正文件系统的读/写权限。
另一方面,Chrome应用程序可以使用 chrome.fileSystem
API 。 您的选项:
- 制作 Chrome App 。如果您需要浏览器集成,则可能无法实现。
- 制作扩展程序和Chrome应用程序,互相交谈,让Chrome应用程序处理文件操作。复杂的安装,但最大的灵活性。
- 制作一个扩展,使用原生主机模块对文件系统进行操作。它会更加复杂的安装,但是无限大功率。
- 制作可与它自己的虚拟文件系统;如果用户需要文件,则可以使用
chrome.downloads
API 来导出它。 - 创建可与某种云存储解决方案配合使用的扩展,例如包含 Dropbox 中的文件。
I am new to chrome extension and i need to develop a chrome extension which can handle text/json files (should be able to perform read-write operations).Files will be stored at the same machine(path may be D:/abc/xyz.text) where i will install chrome extension.Does any one have any idea?
解决方案
That would sadly be not easy or downright impossible - a Chrome Extension cannot get read/write permissions for the real filesystem.
A Chrome App on the other hand can, using chrome.fileSystem
API.
Your options:
- Make a Chrome App instead. Might not be possible if you need browser integration.
- Make an extension and a Chrome App that talk to each other, letting the Chrome App handle the file operations. Complicated install, but maximum flexibility.
- Make an extension that uses a Native Host module to do operations with the filesystem. It will be even more complicated install, but UNLIMITED POWER.
- Make an extension that works with its own virtual filesystem; if the user needs a file, you can use
chrome.downloads
API to export it. - Make an extension that works with some sort of cloud storage solution, e.g. with files in Dropbox.
这篇关于Chrome扩展程序包含文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文