# com.danleech.cordova.plugin.imagecache

> Image cache plugin

Latest version **1.0.0** (published 2018-12-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install com.danleech.cordova.plugin.imagecache
pnpm add com.danleech.cordova.plugin.imagecache
yarn add com.danleech.cordova.plugin.imagecache
bun add com.danleech.cordova.plugin.imagecache
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-12-21 |
| First published | 2018-12-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 39.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Daniil Kostin |
| Maintainers | dan-leech |
| Keywords | cordova, image, cache, image cache, ecosystem:cordova, cordova:android, cordova:ios |

## Links

- npm: https://www.npmjs.com/package/com.danleech.cordova.plugin.imagecache
- Repository: https://github.com/dan-leech/com.danleech.cordova.plugin.imagecache
- Homepage: https://github.com/dan-leech/com.danleech.cordova.plugin.imagecache#readme
- Issues: https://github.com/dan-leech/com.danleech.cordova.plugin.imagecache/issues
- npm.io page: https://npm.io/package/com.danleech.cordova.plugin.imagecache

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2018-12-21

## README

# Cordova Image Cache plugin

Native Image Cache plugin for iOS and Android.

This plugin do not require any permissions or dependencies. It uses temporary folders to store binary representation of your images with timestamps. If timestamps are greater it stores a new image version. Plugin has two levels of cache in browser ram and on the device for increase loading speed.


# Install
```
cordova plugin add com.danleech.cordova.plugin.imagecache
```

# Usage

#### Simple:
```js
let p = new Promise((resolve, reject) => {
  cordova.plugins.ImageCache.get(imageUrl, timestamp, resolve, () => {
    cordova.plugins.ImageCache.store(imageUrl, timestamp, imageUrl, resolve, reject);
  });
});

p.then(url => {
  // already loaded image url
  let img = new Image();
  img.src = url;
})
```
#### Firebase Storage
```js
let p = new Promise((resolve, reject) => {
  cordova.plugins.ImageCache.get(imageKey, timestamp, resolve, () => {
    firebase.storage().refFromURL(imageKey).getDownloadURL()
        .catch(err => {
          reject(err);
        })
        .then(url => {
          cordova.plugins.ImageCache.store(imageKey, timestamp, url, resolve, reject);
        });
  });
});
```

# License
Project is available under the MIT license. See the LICENSE file for more info.

---
_Source: https://npm.io/package/com.danleech.cordova.plugin.imagecache · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
