Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

write the file being shared when we receive it

  • Loading branch information...
commit cbac0db9caeb5fe1c504414d70028d1e6fe83935 1 parent ac9e620
@towski towski authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 hutmp.js
View
8 hutmp.js
@@ -8,7 +8,11 @@ pub = zmq.createSocket('pub')
sub.subscribe("dakee.js")
sub.on('message', function(data) {
- console.log(data.toString());
+ data = data.slice("dakee.js \n".length)
+ fs.open("dakee.js", "w+", 0666, function(err, fd){
+ buffer = new Buffer(data);
+ fs.write(fd, buffer, 0, buffer.length)
+ })
});
sub.on('error', function(error) {
@@ -27,4 +31,4 @@ process.on('SIGINT', function () {
fs.watchFile("dakee.js", function (curr, prev) {
pub.send("dakee.js \n" + fs.readFileSync('dakee.js').toString())
-});
+});
Please sign in to comment.
Something went wrong with that request. Please try again.