Package Exports
- bser
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
BSER Binary Protocol
For more details about the protocol see Watchman's docs.
API
var bser = require('bser');
Buffer
Create
var bunser = new bser.BunserBuf();
Append
bunser.append(buf);
Read
bunser.on('value', function(obj) {
console.log(obj);
});
Dump
bser.dumpToBuffer(obj);
Example
Read BSER from socket:
var bunser = new bser.BunserBuf();
bunser.on('value', function(obj) {
console.log('data from socket', obj);
});
var socket = net.connect('/socket');
socket.on('data', function(buf) {
bunser.append(buf);
});
Write BSER to socket:
socket.write(bser.dumpToBuffer(obj));