Chrome扩展api是否支持直接从浏览缓存中下载? [英] Does chrome extension api support downloads directly from browsing cache?

查看:99
本文介绍了Chrome扩展api是否支持直接从浏览缓存中下载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在内容脚本中抓取图像url,然后调用 chrome.downloads.download 在后台脚本中下载它们。我发现如果用户在< / strong>的上下文菜单中点击保存图片为, IMG>对象,下载速度非常快,几乎无缝。我认为它直接从缓存下载。



然而,使用chrome.downloads似乎与< img>的加载无关。对象;即使图片已经加载到网页上, chrome.downloads.download 需要一些时间来下载每张图片,而不是像 save image as 。所以我认为它从url下载,不管缓存。

其实这样做每个图片下载两次:一个缓存到浏览器显示,另一个下载夹。这显然是浪费时间和资源。

所以...回到主题:是否有任何API支持从Chrome浏览器页面直接下载?就像将图片保存为一样​​。

解决方案

面向公众的Chrome API非常落后。它们并不具备浏览器提供的大部分功能。



总之,不,你不能。 保存图片为是您访问缓存并将其保存到磁盘上其他位置的唯一方式。


I'm implementing a simple web picture grabber, using chrome.downloads api.

I grab the image urls in content script, and then call chrome.downloads.download to download them in the background script. It works well, but I want it faster.

I find that if users click "save image as" in the context menu of <img> object, the downloading speed is very fast and almost seamless. I think it downloads directly from cache.

However, using chrome.downloads seems independent of the loading of <img> objects; even though pictures are already loaded on the webpage, chrome.downloads.download takes some time to download each image, not so fast as "save image as". So I think it download from the url, regardless of cache.

In fact, doing so has each picture downloaded twice: one to cache to browser display, the other to download folder. It's clearly a waste of time and net resource.

So... back to the topic: is there any api supporting downloading directly from the chrome's browsing page? Just like "save image as".

解决方案

I have asked the same question before. Chrome APIs for the public is really backward. They don't really have most features the browser offers.

In short, no, you cannot. "Save image as" is the only way you can access the cache and save them to another location on your disk.

这篇关于Chrome扩展api是否支持直接从浏览缓存中下载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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