0.4.13 • Published 11 years ago
burro v0.4.13
Burro
Burro is a useful creature that auto-packages objects in length-prefixed JSON byte streams.
Example
var Burro = require("./lib/burro");
// --------------------------------------------------------------
// send somes stuff
var client = new Burro();
var upstream = client.send();
upstream.on("packet", function(packet) {
console.log("sending:", packet);
});
upstream
.pack({message: "どもうありがとう!", from: "japan", to: "usa"})
.pack({message: "thank you!", from: "usa", to: "japan"});
// --------------------------------------------------------------
// receive some stuff
var server = new Burro();
var downstream = server.receive(upstream);
downstream.on("packet", function(packet) {
console.log("received:", packet);
});
// --------------------------------------------------------------
// send some more; pipe remains open
setTimeout(function() {
upstream.pack("^.^");
}, 1000);
Tests
requires: npm install mocha
Burro is a pretty versatile beast and can even handle very large payloads.
See test/burro_test.js
for more details.
0.4.13
11 years ago
0.4.12
11 years ago
0.4.11
11 years ago
0.4.10
11 years ago
0.4.9
11 years ago
0.4.8
11 years ago
0.4.7
11 years ago
0.4.6
11 years ago
0.4.5
11 years ago
0.4.4
11 years ago
0.4.3
11 years ago
0.4.2
11 years ago
0.4.1
11 years ago
0.4.0
11 years ago
0.3.0
11 years ago
0.2.0
11 years ago
0.1.1
11 years ago
0.1.0
11 years ago