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

multiplex

Package Overview
Dependencies
Maintainers
3
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multiplex - npm Package Compare versions

Comparing version 4.0.1 to 5.0.0

15

index.js

@@ -19,4 +19,5 @@ var protobuf = require('protocol-buffers')

var dup = duplexify.obj(decode, encode)
var lazy = opts.lazy
var addChannel = function(list, index, name) {
var addChannel = function(list, index, name, open) {
var stream = duplexify.obj()

@@ -62,2 +63,7 @@ var channel = list === remote ? -(index+1) : index+1

if (open) {
encode.write(messages.Frame.encode({channel:channel, type:TYPE.OPEN, name:name}))
name = null
}
return stream

@@ -83,3 +89,3 @@ }

if (!reply && !remote[index] && onstream) {
onstream(addChannel(remote, index, frame.name), frame.name || index)
onstream(addChannel(remote, index, frame.name, false), frame.name || index)
}

@@ -93,2 +99,5 @@

switch (frame.type) {
case TYPE.OPEN:
return cb()
case TYPE.DATA:

@@ -129,3 +138,3 @@ return stream.write(frame.data, cb)

if (index === -1) index = local.push(null)-1
return addChannel(local, index, name && ''+name)
return addChannel(local, index, name && ''+name, !lazy)
}

@@ -132,0 +141,0 @@

2

package.json
{
"name": "multiplex",
"version": "4.0.1",
"version": "5.0.0",
"description": "A binary stream multiplexer. Stream multiple streams of binary data over a single binary stream.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -18,6 +18,7 @@ # multiplex

* `opts.error` - forward errors on individual streams
* `opts.lazy` - only open a channel when you start writing to it
### `multiplex.createStream([id])`
Creates a new sub-stream with an optional whole string `id` (default is the stream channel id).
Creates a new sub-stream with an optional whole string `id` (default is the stream channel id).

@@ -24,0 +25,0 @@ Sub-streams are duplex streams.

Sorry, the diff of this file is not supported yet

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