lisaogren / axios-cache-adapter

Caching adapter for axios. Store request results in a configurable store to prevent unneeded network requests.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to cache binary data?

ouyuran opened this issue · comments

I've tried to cache an image url but failed.

const res1 = await api.get(image-url);
const res2 = await api.get(image-url);
console.log(res1.request.fromCache);
console.log(res2.request.fromCache);
console.log(await api.cache.length());

The output is undefined, undefined and 0.

I think the reason might be it uses JSON.parse(res.data) to serialize data before setItem.

What's more, can we try to cache the response with content-type stream?

If you you guys think they are valuable features I'll be happy to implement they.