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

mux-demux

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mux-demux - npm Package Compare versions

Comparing version 3.3.6 to 3.4.0

test/pause.js

30

index.js

@@ -5,2 +5,3 @@ 'use strict';

, extend = require('xtend')
, duplex = require('duplex')
, serializer = require('stream-serializer')

@@ -21,3 +22,5 @@

var streams = {}, streamCount = 0
var md = through(function (data) {
var md = duplex().resume()
md.on('_data', function (data) {
var id = data.shift()

@@ -29,6 +32,6 @@ var event = data[0]

return
if(event != 'new')
if(event != 'new')
return outer.emit('unknown', id)
md.emit('connection', createStream(id, data[1].meta, data[1].opts))
}
}
else if (event === 'pause')

@@ -78,5 +81,2 @@ s.paused = true

md.pause = function () {}
md.resume = function () {}
function createStream(id, meta, opts) {

@@ -90,6 +90,6 @@ streamCount ++

}
md.emit('data', [s.id, 'data', data])
md._data([s.id, 'data', data])
}, function () {
md.emit('data', [s.id, 'end'])
md._data([s.id, 'end'])
if (this.readable && !opts.allowHalfOpen && !this.ended) {

@@ -100,9 +100,9 @@ this.emit("end")

s.pause = function () {
md.emit('data', [s.id, 'pause'])
md._data([s.id, 'pause'])
}
s.resume = function () {
md.emit('data', [s.id, 'resume'])
md._data([s.id, 'resume'])
}
s.error = function (message) {
md.emit('data', [s.id, 'error', message])
md._data([s.id, 'error', message])
}

@@ -112,3 +112,3 @@ s.once('close', function () {

streamCount --
md.emit('data', [s.id, 'close'])
md._data([s.id, 'close'])
if(streamCount === 0)

@@ -133,3 +133,3 @@ md.emit('zero')

md.once('zero', function () {
md.emit('end')
md._end()
if(cb) cb()

@@ -166,3 +166,3 @@ })

var _opts = {writable: opts.readable, readable: opts.writable}
md.emit('data', [s.id, 'new', {meta: meta, opts: _opts}])
md._data([s.id, 'new', {meta: meta, opts: _opts}])
return s

@@ -169,0 +169,0 @@ }

{
"name": "mux-demux",
"version": "3.3.6",
"version": "3.4.0",
"description": "",

@@ -13,3 +13,4 @@ "homepage": "http://github.com/dominictarr/mux-demux",

"stream-serializer": "~0.0.3",
"through": "~1.1.0"
"through": "~1.1.0",
"duplex": "~1.0.0"
},

@@ -16,0 +17,0 @@ "scripts": {

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