Image Cache Core
npm i capacitor-image-cache
import { ImageCache } from 'capacitor-image-cache';
const cache = new ImageCache();
const { value } = await cache.get({src:"someSrc"}) // checks if the image is in cache and returns the image if not download, store then return
const { value } = await cache.clear() // Clear entire cache returns a boolean
const { value } = await cache.clearItem({src:"someSrc"}) // Clear item cache returns a boolean
const { value } = await cache.hasItem({src:"someSrc"}) // check if cache has item returns a boolean
Cached Image
Cached Image
Install
Capacitor Image Cache is require for this package
npm i capacitor-image-cache st-cached-image
Usage
<st-cached-image src="https://i.annihil.us/u/prod/marvel/i/mg/e/e0/537bafa34baa9.jpg"></st-cached-image>
If using with ionic
import 'st-cached-image/dist/cached-image';
Update the following file since ionic ignores the file
youAppDir/node_modules/@ionic/app-scripts/config/copy.config.js
copyStCachedImage: {
src: ['{{ROOT}}/node_modules/st-cached-image/dist/cached-image**/*'],
dest: '{{BUILD}}'
}