json-watch

1.0.2 • Public • Published

node-json-watch

auto reload a json file when it's changed without restart your project

installation

npm install json-watch

usage

var jsonWatcher = require('json-watch');
jsonWatcher.watch('/absolute/path/to/the/file.json');
// then you can use `jsonWatcher.get()` to access your data
console.log(jsonWatcher.get())
// if `file.json` is changed, the value of `jsonWatcher.get()` will auto reload, no need to restart your project

Important: use jsonWatcher.get(), not var json = jsonWatcher.get(); console.log(json);. otherwise the json will not change when the file changed

contact me

csser.me

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    67
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    67
  • 1.0.1
    2
  • 1.0.0
    1

Package Sidebar

Install

npm i json-watch

Weekly Downloads

31

Version

1.0.2

License

ISC

Last publish

Collaborators

  • indooorsman