-
-
Save tanepiper/83b0dfa4ab98cbcadf25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var airport = require('airport'); | |
var fs = require('fs'); | |
var net = require('net'); | |
var air = airport('localhost', 9090); | |
var listener = air.connect('watcher'); | |
var server = net.createServer(function(socket) { | |
listener(function(remote) { | |
console.log(remote); | |
socket.on('data', function(d) { | |
console.log(d); | |
}); | |
this.socket = function(cb) { | |
cb(socket); | |
} | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var watch = require('watch'); | |
var airport = require('airport'); | |
var air = airport('localhost', 9090); | |
var fs = require('fs'); | |
air(function(remote, connection) { | |
console.log(remote, connection); | |
watch.createMonitor('./dir1', function(monitor) { | |
monitor.on('created', function(f, stat) { | |
remote.socket(function(s) { | |
fs.createReadStream(f).pipe(s); | |
}); | |
}); | |
monitor.on('changed', function(f, curr, prev) { | |
console.log('changed', f, curr, prev); | |
}); | |
monitor.on('removed', function(f, stat) { | |
console.log('removed', f, stat); | |
}); | |
}); | |
this.foo = function() { | |
} | |
}).listen('watcher'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment