local-cache-json

1.0.3 • Public • Published

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:
Donate Donate

Readme

Keywords

Package Sidebar

Install

npm i local-cache-json

Weekly Downloads

107

Version

1.0.3

License

MIT

Unpacked Size

9.01 kB

Total Files

5

Last publish

Collaborators

  • simeonovp