1.0.1 • Published 5 years ago

random-access-rn-file v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

random-access-rn-file

A random-access-* compatible implementation for React-Native that uses it's filesystem

npm install --save random-access-rn-file

# If you're building an application
# Link the FS APIs
react-native link react-native-fs

# Make node modules work (Make sure to import shim.js)
npm install --save-dev rn-nodeify
rn-nodeify --install --hack

Uses random-access-storage along with react-native-fs to provide the ability to read and write files.

After installing, make sure to run react-native link react-native-fs to set up the native dependencies

Supported operations:

  • read
  • write

Example

import hyperdrive from 'hyperdrive'
import storage from 'random-access-rn-file'

const archive = hyperdrive(storage)

archive.writeFile('/example.txt', 'Hello World', 'utf8')

If you're having trouble getting node APIs to work in React-Native, check out rn-nodeify to see if it helps, or open an issue.