The JavaScript Database, for Node.js, nw.js, electron and the browser
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
nedb/docs/storageBrowser.md

9.8 KiB

storageBrowser

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 chooses the best option depending on user browser (IndexedDB then WebSQL then localStorage)

This version is the browser version

storageBrowser.existsAsync(file) ⇒ Promise.<boolean>

Returns Promise if file exists

Kind: static method of storageBrowser

Param Type
file string

storageBrowser.exists(file, cb)

Callback returns true if file exists

Kind: static method of storageBrowser

Param Type
file string
cb existsCallback

storageBrowser.renameAsync(oldPath, newPath) ⇒ Promise.<void>

Moves the item from one path to another

Kind: static method of storageBrowser

Param Type
oldPath string
newPath string

storageBrowser.rename(oldPath, newPath, c) ⇒ void

Moves the item from one path to another

Kind: static method of storageBrowser

Param Type
oldPath string
newPath string
c NoParamCallback

storageBrowser.writeFileAsync(file, data, [options]) ⇒ Promise.<void>

Saves the item at given path

Kind: static method of storageBrowser

Param Type
file string
data string
[options] object

storageBrowser.writeFile(path, data, options, callback)

Saves the item at given path

Kind: static method of storageBrowser

Param Type
path string
data string
options object
callback function

storageBrowser.appendFileAsync(filename, toAppend, [options]) ⇒ Promise.<void>

Append to the item at given path

Kind: static method of storageBrowser

Param Type
filename string
toAppend string
[options] object

storageBrowser.appendFile(filename, toAppend, [options], callback)

Append to the item at given path

Kind: static method of storageBrowser

Param Type
filename string
toAppend string
[options] object
callback function

storageBrowser.readFileAsync(filename, [options]) ⇒ Promise.<Buffer>

Read data at given path

Kind: static method of storageBrowser

Param Type
filename string
[options] object

storageBrowser.readFile(filename, options, callback)

Read data at given path

Kind: static method of storageBrowser

Param Type
filename string
options object
callback function

storageBrowser.unlinkAsync(filename) ⇒ Promise.<void>

Remove the data at given path

Kind: static method of storageBrowser

Param Type
filename string

Remove the data at given path

Kind: static method of storageBrowser

Param Type
path string
callback function

storageBrowser.mkdirAsync(path, [options]) ⇒ Promise.<(void|string)>

Shim for storage.mkdirAsync, nothing to do, no directories will be used on the browser

Kind: static method of storageBrowser

Param Type
path string
[options] object

storageBrowser.mkdir(path, options, callback)

Shim for storage.mkdir, nothing to do, no directories will be used on the browser

Kind: static method of storageBrowser

Param Type
path string
options object
callback function

storageBrowser.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 storageBrowser

Param Type
filename string

storageBrowser.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 storageBrowser

Param Type Description
filename string
callback NoParamCallback

signature: err

storageBrowser.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 storageBrowser

Param Type
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

Param Type Description
filename string
lines Array.<string>
[callback] NoParamCallback

Optional callback, signature: err

storageBrowser~existsCallback : function

Kind: inner typedef of storageBrowser

Param Type
exists boolean