react-native-filecache
v1.1.31
Published
File caching
Downloads
16
Maintainers
Readme
react-native-filecache
react-native file caching helper.
Feature
- Caching remote files.
- Manage caches you created.
Usage
import FileCache from 'react-native-filecache'
fetch
const response = await FileCache.fetch(uri)
const blob = response.blob('image/png')
const text = response.text()
cache
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
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
await FileCache.clearAll()
TODO: clear
await FileCache.clear(cacheObj)
TODO: clear tagged
await FileCache.clearTagged('tag-1')
Install
# 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