1.0.3 • Published 8 months ago

local-cache-json v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

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

1.0.3

8 months ago

1.0.2

9 months ago

1.0.1

11 months ago

1.0.0

12 months ago