Possible to save cached items without redownloading?

I’m developing an addon called Bazzacuda ^2. Basically the addon batch downloads images from tabs and closes tabs after a succesfully download.

Currently the addon redownloads images from source servers. This causes users to waste bandwidth and can cause slowdowns for the addon with slow connections, as tabs are closed only when download is completed.

So, I’m looking a way to save user’s bandwidth. Is there a way to save cached items? Or is there something better available?

If you make the request within the same cookieStoreId context (which is the case for normal tabs and the background page), normal HTTP caching mechanisms should already apply.

If that is not enough, you could grab the images as they are displayed on the page and directly save them, without touching the network stack at all.
Just be aware that this would not fork for all (e.g. cross.origin) images, and if it works, it will re-encode the images (loosing quality and/or increasing the final file size).
To do this, draw the image element on a canvas (and do a normal download as fallback), get the canvas content as blob or (base64) string, send it to the background, and invoke the download() function. (I am not sure if you can directly use a page blob:-URL or if casting a string to one in the background before downloading would be faster, you should try it, though.)

At the moment, WebExtension doesn’t have an API to access browser cache. Any save via an extension (i.e. download API) creates a new request and the items are downloaded again, even when saving images that are already displaying on the page.

The only way to use the already cached item is to manually save the item from browsers window by the user (not extension).