🚀 Launch Week Day 4:Introducing the Alert Details Page: A Better Way to Explore Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

binary-message-stream

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

binary-message-stream

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

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

binary-message-stream

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

npm install binary-message-stream

Usage

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'
  // <Buffer 00 00>
  // { yes: <Buffer 79 65 73> }
  console.log(message)
})

License

MIT

FAQs

Package last updated on 18 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts