简体   繁体   English

Chrome扩展程序保存临时文件

[英]Chrome Extension save temporary file

I have a Chrome Extension that needs to temporarily save a few (two or three) PNG images. 我有一个Chrome扩展程序,该扩展程序需要暂时保存一些(两个或三个)PNG图片。

What I am currently doing is getting the image data URI, and saving this in localstorage. 我目前正在做的是获取图像数据URI,并将其保存在localstorage中。 But I know that this is not a very good way of doing it, especially as some of the images are bigger than 5mb, and I therefore have difficulty storing them. 但是我知道这不是一个很好的方法,特别是当某些图像大于5mb时,因此很难存储它们。

I've seen a few extensions (Single File Extension, and a few others) that have the ability of "saving" a temporary file in the extension folder, but I am not sure how I can achieve this. 我已经看到了一些扩展名(单个文件扩展名和其他一些扩展名),它们能够将临时文件“保存”在扩展名文件夹中,但是我不确定如何实现。

Can anyone help me out? 谁能帮我吗?

You can use HTML5 FileSystem APIs to save your images to a target directory. 您可以使用HTML5 FileSystem API将图像保存到目标目录。

If your option is not limited to chrome extensions, you can write an chrome app, and then chrome.fileSystem is available to you. 如果您的选择不限于chrome扩展名,则可以编写一个chrome应用程序,然后chrome.fileSystem可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM