real-time-file

2.0.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i real-time-file

Weekly Downloads

2

Version

2.0.0

License

MIT

Unpacked Size

7.09 kB

Total Files

9

Last publish

Collaborators

  • zen_flow