Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

burro

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

burro - npm Package Compare versions

Comparing version 0.4.6 to 0.4.7

9

example.js

@@ -6,7 +6,7 @@ #!/usr/bin/env node

// dummy i/o
var dummy = new stream.PassThrough();
// dummy network stream
var network = new stream.PassThrough();
// wrap! auto encode/decode json frames
var socket = burro.wrap(dummy);
var socket = burro.wrap(network);

@@ -20,4 +20,3 @@ // send data

parser._transform = function _transform (obj, encoding, done) {
var str = obj.from + " says: " + obj.message + "\n";
this.push(str);
this.push(obj.from + " says: " + obj.message + "\n");
done();

@@ -24,0 +23,0 @@ };

{
"name": "burro",
"version": "0.4.6",
"version": "0.4.7",
"description": "auto-packaged, length-prefixed JSON byte streams",

@@ -5,0 +5,0 @@ "main": "lib/burro",

Burro
=====
Burro is a useful creature that auto-packages objects in length-prefixed JSON byte streams.
Burro is a useful creature that auto-packages objects in length-prefixed JSON
byte streams.
Overview
--------
Burro is made up of **4 streams** that makes sending/receiving objects a breeze
Sender streams:
* _burro.Encoder_ - encodes objects into proper JSON strings
* _burro.Framer_ - frames JSON in a **uint32be** length-prefixed buffer
Receiver streams:
* _burro.Unframer_ - processes length prefix and parses out JSON
* _burro.Decoder_ - decodes JSON into objects
Example

@@ -13,7 +31,7 @@ -------

// dummy i/o
var dummy = new stream.PassThrough();
// dummy network stream
var network = new stream.PassThrough();
// wrap! auto encode/decode json frames
var socket = burro.wrap(dummy);
var socket = burro.wrap(network);

@@ -27,4 +45,3 @@ // send data

parser._transform = function _transform (obj, encoding, done) {
var str = obj.from + " says: " + obj.message + "\n";
this.push(str);
this.push(obj.from + " says: " + obj.message + "\n");
done();

@@ -39,3 +56,2 @@ };

Output
------

@@ -48,10 +64,56 @@ ```

Installation
------------
Available via [npm][burro]:
> $ npm install burro
Or via git:
> $ git clone git://github.com/naomik/burro.git node_modules/burro
API
---
**wrap**
This is burro's easy mode. It will automatically construct the entire burro
chain around your existing duplex stream. If you want to configure the burro
chain manually, please see [lib/burro.js][lib]
```js
var socket = burro.wrap([duplexStream]);
```
Arguments
* _duplexStream_ - an object implementing the `stream.Duplex` API. It must have
the following functions defined: `_read`, `_write`, `pipe`, `unpipe`.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Tests
-----
requires: `npm install mocha`
Burro is a pretty versatile beast and can even handle very large payloads. It is
also tested against network packet **fragmenting** and **buffering**, thanks to
[hiccup][hiccup]. See the [tests][tests] for more details.
Burro is a pretty versatile beast and can even handle very large payloads.
See the [tests][1] for more details.
Development dependencies:
[1]: https://github.com/naomik/burro/tree/master/test
* [mocha][mocha]
* [hiccup][hiccup]
> $ npm install mocha
> $ npm install hiccup
[burro]: https://npmjs.org/package/burro
[lib]: https://github.com/naomik/burro/blob/master/lib/burro.js#L10-L14
[tests]: https://github.com/naomik/burro/tree/master/test
[mocha]: https://npmjs.org/package/mocha
[hiccup]: https://npmjs.org/package/hiccup
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc