react-native-filecache

1.1.31 • Public • Published

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

Package Sidebar

Install

npm i react-native-filecache

Weekly Downloads

0

Version

1.1.31

License

MIT

Unpacked Size

315 kB

Total Files

52

Last publish

Collaborators

  • yusukeshibata