Loading…
Oh yeah, we have image cache uses IndexedDB!
Oh yeah, we have Image Cache uses IndexedDB!
Pros:
Arguments:
Thoughts:
npm i indexeddb-image-cache
import ImageCache from 'indexeddb-image-cache'
const BASE64 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII';
const cache = new ImageCache({ version: 1 });
await cache.init();
await cache.putImage('trophy', BASE64);
// await cache.putBlob('blob', blobInstance)
// somewhere else
// it will return string by URL.createObjectURL()
// get blob easily by: let blob = await fetch(url).then(r => r.blob());
const image = await cache.getImage('trophy')
It includes test examples using vite test
npm run build
npm run test
npm run coverage
npm pack
npm pack --dry-run
npm run lint
npm run lint-and-fix
npm run pretty
npm run clean-up
No comments yet.
Sign in to be the first to comment.