Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

Is it possible to cache binary data? #255

Open
ouyuran opened this issue Aug 9, 2021 · 0 comments
Open

Is it possible to cache binary data? #255

ouyuran opened this issue Aug 9, 2021 · 0 comments

Comments

@ouyuran
Copy link

ouyuran commented Aug 9, 2021

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant