9.7 KiB
storageBrowser
Way data is stored for this database
This version is the browser version and uses [localforage](https://github.com/localForage/localForage) which chooses the best option depending on user browser (IndexedDB then WebSQL then localStorage).
See
- module:storage
- module:storageReactNative
- storageBrowser
- 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.<Buffer>
- .readFile(filename, options, callback)
- .unlinkAsync(filename) ⇒
Promise.<void>
- .unlink(path, callback)
- .mkdirAsync(path, [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
storageBrowser.existsAsync(file) ⇒ Promise.<boolean>
Returns Promise if file exists.
Async version of [exists](#module_storageBrowser.exists).
Kind: static method of storageBrowser
See: module:storageBrowser.exists
Params
- file
string
storageBrowser.exists(file, cb)
Callback returns true if file exists.
Kind: static method of storageBrowser
Params
- file
string
- cb
existsCallback
storageBrowser.renameAsync(oldPath, newPath) ⇒ Promise.<void>
Async version of [rename](#module_storageBrowser.rename).
Kind: static method of storageBrowser
See: module:storageBrowser.rename
Params
- oldPath
string
- newPath
string
storageBrowser.rename(oldPath, newPath, c) ⇒ void
Moves the item from one path to another
Kind: static method of storageBrowser
Params
- oldPath
string
- newPath
string
- c
NoParamCallback
storageBrowser.writeFileAsync(file, data, [options]) ⇒ Promise.<void>
Async version of [writeFile](#module_storageBrowser.writeFile).
Kind: static method of storageBrowser
See: module:storageBrowser.writeFile
Params
- file
string
- data
string
- [options]
object
storageBrowser.writeFile(path, data, options, callback)
Saves the item at given path
Kind: static method of storageBrowser
Params
- path
string
- data
string
- options
object
- callback
function
storageBrowser.appendFileAsync(filename, toAppend, [options]) ⇒ Promise.<void>
Async version of [appendFile](#module_storageBrowser.appendFile).
Kind: static method of storageBrowser
See: module:storageBrowser.appendFile
Params
- filename
string
- toAppend
string
- [options]
object
storageBrowser.appendFile(filename, toAppend, [options], callback)
Append to the item at given path
Kind: static method of storageBrowser
Params
- filename
string
- toAppend
string
- [options]
object
- callback
function
storageBrowser.readFileAsync(filename, [options]) ⇒ Promise.<Buffer>
Async version of [readFile](#module_storageBrowser.readFile).
Kind: static method of storageBrowser
See: module:storageBrowser.readFile
Params
- filename
string
- [options]
object
storageBrowser.readFile(filename, options, callback)
Read data at given path
Kind: static method of storageBrowser
Params
- filename
string
- options
object
- callback
function
storageBrowser.unlinkAsync(filename) ⇒ Promise.<void>
Async version of [unlink](#module_storageBrowser.unlink).
Kind: static method of storageBrowser
See: module:storageBrowser.unlink
Params
- filename
string
storageBrowser.unlink(path, callback)
Remove the data at given path
Kind: static method of storageBrowser
Params
- path
string
- callback
function
storageBrowser.mkdirAsync(path, [options]) ⇒ Promise.<(void|string)>
Shim for [mkdirAsync](#module_storage.mkdirAsync), nothing to do, no directories will be used on the browser.
Kind: static method of storageBrowser
Params
- path
string
- [options]
object
storageBrowser.mkdir(path, options, callback)
Shim for [mkdir](#module_storage.mkdir), nothing to do, no directories will be used on the browser.
Kind: static method of storageBrowser
Params
- path
string
- options
object
- callback
function
storageBrowser.ensureDatafileIntegrityAsync(filename) ⇒ Promise.<void>
Shim for [ensureDatafileIntegrityAsync](#module_storage.ensureDatafileIntegrityAsync), nothing to do, no data corruption possible in the browser.
Kind: static method of storageBrowser
Params
- filename
string
storageBrowser.ensureDatafileIntegrity(filename, callback)
Shim for [ensureDatafileIntegrity](#module_storage.ensureDatafileIntegrity), nothing to do, no data corruption possible in the browser.
Kind: static method of storageBrowser
Params
- filename
string
- callback
NoParamCallback
-signature: err
storageBrowser.crashSafeWriteFileLinesAsync(filename, lines) ⇒ Promise.<void>
Async version of [crashSafeWriteFileLines](#module_storageBrowser.crashSafeWriteFileLines).
Kind: static method of storageBrowser
See: module:storageBrowser.crashSafeWriteFileLines
Params
- filename
string
- lines
Array.<string>
storageBrowser.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 storageBrowser
Params
- filename
string
- lines
Array.<string>
- [callback]
NoParamCallback
-Optional callback, signature: err
storageBrowser~existsCallback : function
Kind: inner typedef of storageBrowser
Params
- exists
boolean