socketfs

Allows your browser to watch a file.

socketfs

socketfs adds watch and unwatch methods so you can watch files from your browser.

Start the included app.js:

node app.js

Or you can extend your existing express app:

require('./socketfs.server.js')(app, httpServer)

Include requirements:

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="space.js"></script>
<script type="text/javascript" src="socket-io.js"></script>
<script type="text/javascript" src="socketfs.browser.js"></script>

Call your methods:

socketfs.connect()
socketfs.watch('test/hello.txt', function () {
  $('pre').append('test/hello.txt changed\n')
})

Properties:

filename
 tailFn Function
 watcherFn bool
 tails
  socketID String
  socketID...
 mtime Int
 watchers
  socketID String
  socketID...
filename...

Methods:

inspect
resetGlobal
tail
untail
unwatch
watch

Properties:

filename
 tails
  0 fn
  ...
 watches
  0 fn
  ...
filename...

Methods:

inspect
resetGlobal
tail
untail
unwatch
watch

MIT

Breck Yunits

watch files

watch dirs

  • more robust tests
  • server method to clear all watchers (to make testing easier)
  • reestablish watchers when server resets ?
  • rate limit?
  • tail?