1.0.7 • Published 8 months ago

@exodus/storage-mobile v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@exodus/storage-mobile

Usage

To use the module call the factory and pass in required dependencies

import { hashSync } from '@exodus/crypto/hash'
import createStorageMobile from '@exodus/storage-mobile'
import AsyncStorage from '@exodus/react-native-async-storage'
import fs from '@exodus/react-native-fs'

const hashString = (str) => hashSync('sha256', str, 'hex').slice(0, 20)

const storage = createStorageMobile({
  asyncStorage: AsyncStorage,
  androidFallback: {
    filesystem: {
      rimraf: fs.unlink.bind(fs),
      mkdirp: fs.mkdir.bind(fs),
      readUtf8: fs.readUtf8.bind(fs),
      writeUtf8: fs.writeUtf8.bind(fs),
    },
    placeholder: '~', // will be written to the async storage for files larger than the threshold
    rootDir: fs.DocumentDirectoryPath + '/async-storage',
    hashString,
    threshold: 1.9 * 1024 * 1024, // 2 megs, slightly lower to avoid the edge cases too close to the limit
  },
})
1.0.7

8 months ago

1.0.6

9 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.1.0

3 years ago

0.0.0

3 years ago