2.0.0 • Published 7 years ago

real-time-file v2.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

real-time-file

live readable+writable representation of a file

Build Status tested with jest npm version Dependencies Status Greenkeeper badge semantic-release badge License: MIT

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