# react-native-filecache

react-native file caching helper.

## Feature

* Caching remote files.
* Manage caches you created.

## Usage

```js
import FileCache from 'react-native-filecache'
```

### fetch

```js
const response = await FileCache.fetch(uri)
const blob = response.blob('image/png')
const text = response.text()
```

### cache

```js
const cacheObj = await FileCache.cache(uri)
// { id: 'cache_id_as_string', path: '/absolute/path/to_native_cached_file' }
console.log(cacheObj)
```

### TODO: cache with tag

```js
const cacheObj = await FileCache.cache(uri, 'tag-1')
// { tag: 'tag-1', id: 'cache_id_as_string', path: '/absolute/path/to_native_cached_file' }
console.log(cacheObj)
```

### TODO: clearAll

```js
 await FileCache.clearAll()
```

### TODO: clear

```js
await FileCache.clear(cacheObj)
```

### TODO: clear tagged

```js
await FileCache.clearTagged('tag-1')
```

## Install

```sh
# install
npm install react-native-filecache
# link in your project
react-native link react-native-filecache
```

## TODO

* Cache with tag.
* Remove tagged caches at once.

## Author

Yusuke Shibata

## Licence

MIT
