local-cache-json
v1.0.3
Published
Library for managing local cache with json data
Downloads
517
Readme
local-cache-json
Library for managing local cache with json data
Parameter description
config params:
- path: local folder for the sorage
- url: URL of global cache, e.g. shared by multiple projects
- backPath: (optional) folder used for backups
manifest: a special DB contains meta data, e.g. for tracking local changes and sychronisation infos
Usage example
const { DbBase } = require('local-cache-json')
const path = require('path')
const resDir = path.join(__dirname, 'resources)
const db = new DbBase({ path: path.join(resDir, 'data.json') })
db.load()
const data = db.data || {}
data['newParam'] = 'parValus'
db.save(true, true)
the first parameter of the methos save is 'force' (boolean) to overwriting existing storage the second parameter of the methos save is either 'true' (for default key sorting) or a locale string (e.g. 'zh' for sorting china words)
TODO: Extend API description
Thanks
If you like our ideas and want to support further development, you can donate here: