10 KiB
storageReactNative
Way data is stored for this database For a Node.js/Node Webkit database it's the file system For a browser-side database it's localforage, which uses the best backend available (IndexedDB then WebSQL then localStorage) For a react-native database, we use @react-native-async-storage/async-storage
This version is the react-native version
- storageReactNative
- static
- .existsAsync(file) ⇒
Promise.<boolean>
- .exists(file, cb)
- .renameAsync(oldPath, newPath) ⇒
Promise.<void>
- .rename(oldPath, newPath, c) ⇒
void
- .writeFileAsync(file, data, [options]) ⇒
Promise.<void>
- .writeFile(path, data, options, callback)
- .appendFileAsync(filename, toAppend, [options]) ⇒
Promise.<void>
- .appendFile(filename, toAppend, [options], callback)
- .readFileAsync(filename, [options]) ⇒
Promise.<string>
- .readFile(filename, options, callback)
- .unlinkAsync(filename) ⇒
Promise.<void>
- .unlink(path, callback)
- .mkdirAsync(dir, [options]) ⇒
Promise.<(void|string)>
- .mkdir(path, options, callback)
- .ensureDatafileIntegrityAsync(filename) ⇒
Promise.<void>
- .ensureDatafileIntegrity(filename, callback)
- .crashSafeWriteFileLinesAsync(filename, lines) ⇒
Promise.<void>
- .crashSafeWriteFileLines(filename, lines, [callback])
- .existsAsync(file) ⇒
- inner
- ~existsCallback :
function
- ~existsCallback :
- static
storageReactNative.existsAsync(file) ⇒ Promise.<boolean>
Returns Promise if file exists
Kind: static method of storageReactNative
Param | Type |
---|---|
file | string |
storageReactNative.exists(file, cb)
Callback returns true if file exists
Kind: static method of storageReactNative
Param | Type |
---|---|
file | string |
cb | existsCallback |
storageReactNative.renameAsync(oldPath, newPath) ⇒ Promise.<void>
Moves the item from one path to another
Kind: static method of storageReactNative
Param | Type |
---|---|
oldPath | string |
newPath | string |
storageReactNative.rename(oldPath, newPath, c) ⇒ void
Moves the item from one path to another
Kind: static method of storageReactNative
Param | Type |
---|---|
oldPath | string |
newPath | string |
c | NoParamCallback |
storageReactNative.writeFileAsync(file, data, [options]) ⇒ Promise.<void>
Saves the item at given path
Kind: static method of storageReactNative
Param | Type |
---|---|
file | string |
data | string |
[options] | object |
storageReactNative.writeFile(path, data, options, callback)
Saves the item at given path
Kind: static method of storageReactNative
Param | Type |
---|---|
path | string |
data | string |
options | object |
callback | function |
storageReactNative.appendFileAsync(filename, toAppend, [options]) ⇒ Promise.<void>
Append to the item at given path
Kind: static method of storageReactNative
Param | Type |
---|---|
filename | string |
toAppend | string |
[options] | object |
storageReactNative.appendFile(filename, toAppend, [options], callback)
Append to the item at given path
Kind: static method of storageReactNative
Param | Type |
---|---|
filename | string |
toAppend | string |
[options] | object |
callback | function |
storageReactNative.readFileAsync(filename, [options]) ⇒ Promise.<string>
Read data at given path
Kind: static method of storageReactNative
Param | Type |
---|---|
filename | string |
[options] | object |
storageReactNative.readFile(filename, options, callback)
Read data at given path
Kind: static method of storageReactNative
Param | Type |
---|---|
filename | string |
options | object |
callback | function |
storageReactNative.unlinkAsync(filename) ⇒ Promise.<void>
Remove the data at given path
Kind: static method of storageReactNative
Param | Type |
---|---|
filename | string |
storageReactNative.unlink(path, callback)
Remove the data at given path
Kind: static method of storageReactNative
Param | Type |
---|---|
path | string |
callback | function |
storageReactNative.mkdirAsync(dir, [options]) ⇒ Promise.<(void|string)>
Shim for storage.mkdirAsync, nothing to do, no directories will be used on the browser
Kind: static method of storageReactNative
Param | Type |
---|---|
dir | string |
[options] | object |
storageReactNative.mkdir(path, options, callback)
Shim for storage.mkdir, nothing to do, no directories will be used on the browser
Kind: static method of storageReactNative
Param | Type |
---|---|
path | string |
options | object |
callback | function |
storageReactNative.ensureDatafileIntegrityAsync(filename) ⇒ Promise.<void>
Ensure the datafile contains all the data, even if there was a crash during a full file write Nothing to do, no data corruption possible in the browser
Kind: static method of storageReactNative
Param | Type |
---|---|
filename | string |
storageReactNative.ensureDatafileIntegrity(filename, callback)
Ensure the datafile contains all the data, even if there was a crash during a full file write Nothing to do, no data corruption possible in the browser
Kind: static method of storageReactNative
Param | Type | Description |
---|---|---|
filename | string |
|
callback | NoParamCallback |
signature: err |
storageReactNative.crashSafeWriteFileLinesAsync(filename, lines) ⇒ Promise.<void>
Fully write or rewrite the datafile, immune to crashes during the write operation (data will not be lost)
Kind: static method of storageReactNative
Param | Type |
---|---|
filename | string |
lines | Array.<string> |
storageReactNative.crashSafeWriteFileLines(filename, lines, [callback])
Fully write or rewrite the datafile, immune to crashes during the write operation (data will not be lost)
Kind: static method of storageReactNative
Param | Type | Description |
---|---|---|
filename | string |
|
lines | Array.<string> |
|
[callback] | NoParamCallback |
Optional callback, signature: err |
storageReactNative~existsCallback : function
Kind: inner typedef of storageReactNative
Param | Type |
---|---|
exists | boolean |