An open API service indexing awesome lists of open source software.

https://github.com/mafintosh/binary-message-stream

Duplex stream that allows you to send messages, including binary messages
https://github.com/mafintosh/binary-message-stream

Last synced: 8 months ago
JSON representation

Duplex stream that allows you to send messages, including binary messages

Awesome Lists containing this project

README

          

# binary-message-stream

Simple duplex stream that allows you to send messages, including binary messages.

```
npm install binary-message-stream
```

## Usage

``` js
const Messenger = require('binary-message-stream')

const a = new Messenger()
const b = new Messenger()

a.pipe(b).pipe(a)

a.send('hi')
a.send(Buffer.alloc(2))
a.send({ yes: Buffer.from('yes') })

b.on('message', function (message) {
// prints:
// 'hi'
//
// { yes: }
console.log(message)
})
```

## License

MIT