real-time-file
v2.0.0
Published
live readable+writable representation of a file
Downloads
4
Readme
real-time-file
live readable+writable representation of a file
Example
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