Stores each handled JSON Document as a .json file on the file system.
var SimpleFsStorage = require('../lib/sfss.lib'),
options = {
root: __dirname + '/' + 'root'
},
store = new SimpleFsStorage(options);
-
root (mandatory)
: {String} absolut path to the root directory of the store. -
strict
: {Boolean} if true, directories will have to be created usingcreateDirectory
. Default is:false
-
extentions
: {ArrayString} holds the allowed file extentions. Default is:['json']
Creates a single directory - and if strict
mode is disabled, any missing parent as well.
Parameter:
-
dirPath
: {String} relative directory path
Returns an Array holding only subdirectories and JSON files of the specified directory.
Parameter:
-
dirPath
: {String} relative directory path
Deep deletion of a directory (like rm -rf).
Parameter:
-
dirPath
: {String} relative directory path
Returns the content of the specified file.
Parameter
-
filePath
: {String} relative file path
Returns an Array with the content of all JSON files in the specified directory.
Parameter
-
dirPath
: {String} relative directory path
Writes a document at the specified location.
If the specified directory does not exist, it will be created by the method - and if strict
mode is disabled, any missing parent as well.
Parameters
-
filePath
: {String} relative directory path and file name -
content
: {Object|String} file content
Removes the specified file.
Parameter
-
filePath
: {String} relative file path