https://github.com/zenflow/real-time-file
live readable+writable+`subscribe`able representation of a file
https://github.com/zenflow/real-time-file
Last synced: 5 months ago
JSON representation
live readable+writable+`subscribe`able representation of a file
- Host: GitHub
- URL: https://github.com/zenflow/real-time-file
- Owner: zenflow
- License: mit
- Created: 2018-03-19T18:05:36.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-05-24T19:48:30.000Z (about 6 years ago)
- Last Synced: 2025-08-27T15:53:35.464Z (10 months ago)
- Language: JavaScript
- Size: 60.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# real-time-file
live readable+writable representation of a file
[](https://travis-ci.org/zenflow/real-time-file)
[](https://github.com/facebook/jest)
[](https://www.npmjs.com/packages/real-time-file)
[](https://david-dm.org/zenflow/real-time-file)
[](https://greenkeeper.io/)
[](https://github.com/zenflow/real-time-file/blob/master/CHANGELOG.md)
[](https://opensource.org/licenses/MIT)
## Example
```js
const RealTimeFile = require('real-time-file')
const file = new RealTimeFile('.gitignore')
file.on('text', text => {})
file.on('lines', lines => {})
file.ready
.then(() => {
file.lines.unshift('package-lock.json')
// or
file.lines = ['package-lock.json', ...lines]
// or
file.text = `package-lock.json\n${file.text}`
})
.catch(console.error)
```
- saves new contents to file system immediately
- watches the file and reloads when changed by another process