Way data is stored for this database. This version is the Node.js/Node Webkit version. It's essentially fs, mkdirp and crash safe write and read functions.
**See** - module:storageBrowser - module:storageReactNative * [storage](#module_storage) * _static_ * [.exists(file, cb)](#module_storage.exists) * [.existsAsync(file)](#module_storage.existsAsync) ⇒Promise.<boolean>
* [.rename(oldPath, newPath, c)](#module_storage.rename) ⇒ void
* [.renameAsync(oldPath, newPath)](#module_storage.renameAsync) ⇒ Promise.<void>
* [.writeFile(path, data, options, callback)](#module_storage.writeFile)
* [.writeFileAsync(path, data, [options])](#module_storage.writeFileAsync) ⇒ Promise.<void>
* [.writeFileStream(path, [options])](#module_storage.writeFileStream) ⇒ fs.WriteStream
* [.unlink(path, callback)](#module_storage.unlink)
* [.unlinkAsync(path)](#module_storage.unlinkAsync) ⇒ Promise.<void>
* [.appendFile(path, data, options, callback)](#module_storage.appendFile)
* [.appendFileAsync(path, data, [options])](#module_storage.appendFileAsync) ⇒ Promise.<void>
* [.readFile(path, options, callback)](#module_storage.readFile)
* [.readFileAsync(path, [options])](#module_storage.readFileAsync) ⇒ Promise.<Buffer>
* [.readFileStream(path, [options])](#module_storage.readFileStream) ⇒ fs.ReadStream
* [.mkdir(path, options, callback)](#module_storage.mkdir)
* [.mkdirAsync(path, options)](#module_storage.mkdirAsync) ⇒ Promise.<(void\|string)>
* [.ensureFileDoesntExistAsync(file)](#module_storage.ensureFileDoesntExistAsync) ⇒ Promise.<void>
* [.ensureFileDoesntExist(file, callback)](#module_storage.ensureFileDoesntExist)
* [.flushToStorage(options, callback)](#module_storage.flushToStorage)
* [.flushToStorageAsync(options)](#module_storage.flushToStorageAsync) ⇒ Promise.<void>
* [.writeFileLines(filename, lines, [callback])](#module_storage.writeFileLines)
* [.writeFileLinesAsync(filename, lines)](#module_storage.writeFileLinesAsync) ⇒ Promise.<void>
* [.crashSafeWriteFileLines(filename, lines, [callback])](#module_storage.crashSafeWriteFileLines)
* [.crashSafeWriteFileLinesAsync(filename, lines)](#module_storage.crashSafeWriteFileLinesAsync) ⇒ Promise.<void>
* [.ensureDatafileIntegrity(filename, callback)](#module_storage.ensureDatafileIntegrity)
* [.ensureDatafileIntegrityAsync(filename)](#module_storage.ensureDatafileIntegrityAsync) ⇒ Promise.<void>
* _inner_
* [~existsCallback](#module_storage..existsCallback) : function
### storage.exists(file, cb)
Callback returns true if file exists.
**Kind**: static method of [storage
](#module_storage)
**Params**
- file string
- cb [existsCallback
](#module_storage..existsCallback)
### storage.existsAsync(file) ⇒ Promise.<boolean>
Async version of [exists](#module_storage.exists).
**Kind**: static method of [storage
](#module_storage)
**See**: module:storage.exists
**Params**
- file string
### storage.rename(oldPath, newPath, c) ⇒ void
Node.js' [fs.rename](https://nodejs.org/api/fs.html#fsrenameoldpath-newpath-callback).
**Kind**: static method of [storage
](#module_storage)
**Params**
- oldPath string
- newPath string
- c [NoParamCallback
](#NoParamCallback)
### storage.renameAsync(oldPath, newPath) ⇒ Promise.<void>
Async version of [rename](#module_storage.rename).
**Kind**: static method of [storage
](#module_storage)
**See**: module:storage.rename
**Params**
- oldPath string
- newPath string
### storage.writeFile(path, data, options, callback)
Node.js' [fs.writeFile](https://nodejs.org/api/fs.html#fswritefilefile-data-options-callback).
**Kind**: static method of [storage
](#module_storage)
**Params**
- path string
- data string
- options object
- callback function
### storage.writeFileAsync(path, data, [options]) ⇒ Promise.<void>
Async version of [writeFile](#module_storage.writeFile).
**Kind**: static method of [storage
](#module_storage)
**See**: module:storage.writeFile
**Params**
- path string
- data string
- [options] object
### storage.writeFileStream(path, [options]) ⇒ fs.WriteStream
Node.js' [fs.createWriteStream](https://nodejs.org/api/fs.html#fscreatewritestreampath-options).
**Kind**: static method of [storage
](#module_storage)
**Params**
- path string
- [options] Object
### storage.unlink(path, callback)
Node.js' [fs.unlink](https://nodejs.org/api/fs.html#fsunlinkpath-callback).
**Kind**: static method of [storage
](#module_storage)
**Params**
- path string
- callback function
### storage.unlinkAsync(path) ⇒ Promise.<void>
Async version of [unlink](#module_storage.unlink).
**Kind**: static method of [storage
](#module_storage)
**See**: module:storage.unlink
**Params**
- path string
### storage.appendFile(path, data, options, callback)
Node.js' [fs.appendFile](https://nodejs.org/api/fs.html#fsappendfilepath-data-options-callback).
**Kind**: static method of [storage
](#module_storage)
**Params**
- path string
- data string
- options object
- callback function
### storage.appendFileAsync(path, data, [options]) ⇒ Promise.<void>
Async version of [appendFile](#module_storage.appendFile).
**Kind**: static method of [storage
](#module_storage)
**See**: module:storage.appendFile
**Params**
- path string
- data string
- [options] object
### storage.readFile(path, options, callback)
Node.js' [fs.readFile](https://nodejs.org/api/fs.html#fsreadfilepath-options-callback)
**Kind**: static method of [storage
](#module_storage)
**Params**
- path string
- options object
- callback function
### storage.readFileAsync(path, [options]) ⇒ Promise.<Buffer>
Async version of [readFile](#module_storage.readFile).
**Kind**: static method of [storage
](#module_storage)
**See**: module:storage.readFile
**Params**
- path string
- [options] object
### storage.readFileStream(path, [options]) ⇒ fs.ReadStream
Node.js' [fs.createReadStream](https://nodejs.org/api/fs.html#fscreatereadstreampath-options).
**Kind**: static method of [storage
](#module_storage)
**Params**
- path string
- [options] Object
### storage.mkdir(path, options, callback)
Node.js' [fs.mkdir](https://nodejs.org/api/fs.html#fsmkdirpath-options-callback).
**Kind**: static method of [storage
](#module_storage)
**Params**
- path string
- options object
- callback function
### storage.mkdirAsync(path, options) ⇒ Promise.<(void\|string)>
Async version of [mkdir](#module_storage.mkdir).
**Kind**: static method of [storage
](#module_storage)
**See**: module:storage.mkdir
**Params**
- path string
- options object
### storage.ensureFileDoesntExistAsync(file) ⇒ Promise.<void>
Async version of [ensureFileDoesntExist](#module_storage.ensureFileDoesntExist)
**Kind**: static method of [storage
](#module_storage)
**See**: module:storage.ensureFileDoesntExist
**Params**
- file string
### storage.ensureFileDoesntExist(file, callback)
Removes file if it exists.
**Kind**: static method of [storage
](#module_storage)
**Params**
- file string
- callback [NoParamCallback
](#NoParamCallback)
### storage.flushToStorage(options, callback)
Flush data in OS buffer to storage if corresponding option is set.
**Kind**: static method of [storage
](#module_storage)
**Params**
- options object
| string
- If options is a string, it is assumed that the flush of the file (not dir) called options was requested
- [.filename]string
- [.isDir] boolean
= false
- Optional, defaults to false
- callback [NoParamCallback
](#NoParamCallback)
### storage.flushToStorageAsync(options) ⇒ Promise.<void>
Async version of [flushToStorage](#module_storage.flushToStorage).
**Kind**: static method of [storage
](#module_storage)
**See**: module:storage.flushToStorage
**Params**
- options object
| string
- [.filename] string
- [.isDir] boolean
= false
### storage.writeFileLines(filename, lines, [callback])
Fully write or rewrite the datafile.
**Kind**: static method of [storage
](#module_storage)
**Params**
- filename string
- lines Array.<string>
- [callback] [NoParamCallback
](#NoParamCallback) = () => {}
### storage.writeFileLinesAsync(filename, lines) ⇒ Promise.<void>
Async version of [writeFileLines](#module_storage.writeFileLines).
**Kind**: static method of [storage
](#module_storage)
**See**: module:storage.writeFileLines
**Params**
- filename string
- lines Array.<string>
### storage.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 [storage
](#module_storage)
**Params**
- filename string
- lines Array.<string>
- [callback] [NoParamCallback
](#NoParamCallback) - Optional callback, signature: err
### storage.crashSafeWriteFileLinesAsync(filename, lines) ⇒Promise.<void>
Async version of [crashSafeWriteFileLines](#module_storage.crashSafeWriteFileLines).
**Kind**: static method of [storage
](#module_storage)
**See**: module:storage.crashSafeWriteFileLines
**Params**
- filename string
- lines Array.<string>
### storage.ensureDatafileIntegrity(filename, callback)
Ensure the datafile contains all the data, even if there was a crash during a full file write.
**Kind**: static method of [storage
](#module_storage)
**Params**
- filename string
- callback [NoParamCallback
](#NoParamCallback) - signature: err
### storage.ensureDatafileIntegrityAsync(filename) ⇒Promise.<void>
Async version of [ensureDatafileIntegrity](#module_storage.ensureDatafileIntegrity).
**Kind**: static method of [storage
](#module_storage)
**See**: module:storage.ensureDatafileIntegrity
**Params**
- filename string
### storage~existsCallback : function
**Kind**: inner typedef of [storage
](#module_storage)
**Params**
- exists boolean