Skip to content

Commit

Permalink
A new node module for netstring buffering. Lots to do.
Browse files Browse the repository at this point in the history
  • Loading branch information
pekim committed Apr 9, 2011
1 parent 4134831 commit 8ff3bce
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 1 deletion.
File renamed without changes.
14 changes: 14 additions & 0 deletions node/lib/netstring-buffer.js
@@ -0,0 +1,14 @@
var util = require('util'),
events = require('events');

var NetstringBuffer = function () {
events.EventEmitter.call(this);
};

util.inherits(NetstringBuffer, events.EventEmitter);

NetstringBuffer.prototype.put = function (buffer) {
this.emit('payload', 'abc');
}

module.exports = NetstringBuffer;
3 changes: 3 additions & 0 deletions node/package.json
Expand Up @@ -15,5 +15,8 @@
},
"dependencies" : {
"netstring" : ""
},
"devDependencies" : {
"nodeunit" : ""
}
}
2 changes: 1 addition & 1 deletion node/test/jdbc-test.js
@@ -1,2 +1,2 @@
var jdbc = require('jdbc');
var jdbc = require('../lib/jdbc.js');

14 changes: 14 additions & 0 deletions node/test/netstring-buffer-test.js
@@ -0,0 +1,14 @@
var NetstringBuffer = require('../lib/netstring-buffer');

exports.oneString = function(test){
var buffer = new NetstringBuffer();

buffer.on('payload', function(payload) {
test.strictEqual(payload, 'abc');
test.done();
});

test.expect(1);

buffer.put(new Buffer('3:abc,'));
};

0 comments on commit 8ff3bce

Please sign in to comment.