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

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

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

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

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