JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 27950449
  • Score
    100M100P100Q276876F
  • License BSD-2-Clause

JavaScript implementation of the BSER Binary Protocol

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));