## 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](#module_storageBrowser) * _static_ * [.existsAsync(file)](#module_storageBrowser.existsAsync) ⇒ Promise.<boolean> * [.exists(file, cb)](#module_storageBrowser.exists) * [.renameAsync(oldPath, newPath)](#module_storageBrowser.renameAsync) ⇒ Promise.<void> * [.rename(oldPath, newPath, c)](#module_storageBrowser.rename) ⇒ void * [.writeFileAsync(file, data, [options])](#module_storageBrowser.writeFileAsync) ⇒ Promise.<void> * [.writeFile(path, data, options, callback)](#module_storageBrowser.writeFile) * [.appendFileAsync(filename, toAppend, [options])](#module_storageBrowser.appendFileAsync) ⇒ Promise.<void> * [.appendFile(filename, toAppend, [options], callback)](#module_storageBrowser.appendFile) * [.readFileAsync(filename, [options])](#module_storageBrowser.readFileAsync) ⇒ Promise.<Buffer> * [.readFile(filename, options, callback)](#module_storageBrowser.readFile) * [.unlinkAsync(filename)](#module_storageBrowser.unlinkAsync) ⇒ Promise.<void> * [.unlink(path, callback)](#module_storageBrowser.unlink) * [.mkdirAsync(path, [options])](#module_storageBrowser.mkdirAsync) ⇒ Promise.<(void\|string)> * [.mkdir(path, options, callback)](#module_storageBrowser.mkdir) * [.ensureDatafileIntegrityAsync(filename)](#module_storageBrowser.ensureDatafileIntegrityAsync) ⇒ Promise.<void> * [.ensureDatafileIntegrity(filename, callback)](#module_storageBrowser.ensureDatafileIntegrity) * [.crashSafeWriteFileLinesAsync(filename, lines)](#module_storageBrowser.crashSafeWriteFileLinesAsync) ⇒ Promise.<void> * [.crashSafeWriteFileLines(filename, lines, [callback])](#module_storageBrowser.crashSafeWriteFileLines) * _inner_ * [~existsCallback](#module_storageBrowser..existsCallback) : function ### storageBrowser.existsAsync(file) ⇒ Promise.<boolean>

Returns Promise if file exists

**Kind**: static method of [storageBrowser](#module_storageBrowser) | Param | Type | | --- | --- | | file | string | ### storageBrowser.exists(file, cb)

Callback returns true if file exists

**Kind**: static method of [storageBrowser](#module_storageBrowser) | Param | Type | | --- | --- | | file | string | | cb | [existsCallback](#module_storageBrowser..existsCallback) | ### storageBrowser.renameAsync(oldPath, newPath) ⇒ Promise.<void>

Moves the item from one path to another

**Kind**: static method of [storageBrowser](#module_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](#module_storageBrowser) | Param | Type | | --- | --- | | oldPath | string | | newPath | string | | c | [NoParamCallback](#NoParamCallback) | ### storageBrowser.writeFileAsync(file, data, [options]) ⇒ Promise.<void>

Saves the item at given path

**Kind**: static method of [storageBrowser](#module_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](#module_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](#module_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](#module_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](#module_storageBrowser) | Param | Type | | --- | --- | | filename | string | | [options] | object | ### storageBrowser.readFile(filename, options, callback)

Read data at given path

**Kind**: static method of [storageBrowser](#module_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](#module_storageBrowser) | Param | Type | | --- | --- | | filename | string | ### storageBrowser.unlink(path, callback)

Remove the data at given path

**Kind**: static method of [storageBrowser](#module_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](#module_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](#module_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](#module_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](#module_storageBrowser) | Param | Type | Description | | --- | --- | --- | | filename | string | | | callback | [NoParamCallback](#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](#module_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](#module_storageBrowser) | Param | Type | Description | | --- | --- | --- | | filename | string | | | lines | Array.<string> | | | [callback] | [NoParamCallback](#NoParamCallback) |

Optional callback, signature: err

| ### storageBrowser~existsCallback : function **Kind**: inner typedef of [storageBrowser](#module_storageBrowser) | Param | Type | | --- | --- | | exists | boolean |