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
- Host: GitHub
- URL: https://github.com/mafintosh/binary-message-stream
- Owner: mafintosh
- License: mit
- Created: 2020-11-13T16:10:00.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-18T17:41:01.000Z (about 5 years ago)
- Last Synced: 2025-04-20T18:51:28.060Z (8 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 17
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome_frontend_development_resources - binary-message-stream - Duplex stream that allows you to send messages, including binary messages. (Utilities / React Components)
- awesome - binary-message-stream - Duplex stream that allows you to send messages, including binary messages. (Utilities / React Components)
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