https://github.com/oknoorap/json-realtime
:trident: Read and Write JSON in realtime.
https://github.com/oknoorap/json-realtime
json
Last synced: 2 months ago
JSON representation
:trident: Read and Write JSON in realtime.
- Host: GitHub
- URL: https://github.com/oknoorap/json-realtime
- Owner: oknoorap
- License: mit
- Created: 2017-04-12T01:24:34.000Z (about 9 years ago)
- Default Branch: develop
- Last Pushed: 2018-09-07T05:30:42.000Z (almost 8 years ago)
- Last Synced: 2026-04-09T04:23:03.225Z (3 months ago)
- Topics: json
- Language: JavaScript
- Homepage:
- Size: 50.8 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# :pencil: JSON Realtime
Read and Write JSON in realtime. You don't need to open and write json file twice. It's just magic. It's support nested object too.
# Install
```bash
# npm
npm install json-realtime --save
# yarn
yarn add json-realtime
```
# Usage
```javascript
import jsonr from 'json-realtime'
/**
* Your current file is
* { "greetings": "yo" }
*/
const json = jsonr('./path/to/file.json')
// Return 'yo'
console.log(json.greetings)
// Set greetings
json.greetings = 'hello'
// Set non existing
json.mynumber = 10
// Return 'hello'
console.log(json.greetings)
/**
* Your current file right now
* { "greetings": "hello", "mynumber": 10 }
*/
```
# License
MIT © [oknoorap](https://github.com/oknoorap)