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

streamx

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

streamx - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

test/backpressure.js

16

index.js

@@ -81,2 +81,3 @@ const { EventEmitter } = require('events')

const SHOULD_NOT_READ = OPEN_STATUS | READ_ACTIVE | READ_ENDING | READ_DONE | READ_NEEDS_PUSH
const READ_BACKPRESSURE_STATUS = DESTROY_STATUS | READ_ENDING | READ_DONE

@@ -91,2 +92,3 @@ // Combined write state

const WRITE_FINISHING_STATUS = OPEN_STATUS | WRITE_FINISHING | WRITE_QUEUED
const WRITE_BACKPRESSURE_STATUS = WRITE_UNDRAINED | DESTROY_STATUS | WRITE_FINISHING | WRITE_DONE

@@ -486,2 +488,3 @@ const asyncIterator = Symbol.asyncIterator || Symbol('asyncIterator')

if (opts.destroy) this._destroy = opts.destroy
if (opts.predestroy) this._predestroy = opts.predestroy
}

@@ -498,2 +501,6 @@ }

_predestroy () {
// does nothing
}
get destroyed () {

@@ -511,2 +518,3 @@ return (this._duplexState & DESTROYED) !== 0

this._duplexState = (this._duplexState | DESTROYING) & NON_PRIMARY
this._predestroy()
if (this._readableState !== null) {

@@ -592,2 +600,6 @@ this._readableState.error = err

static isBackpressured (rs) {
return (rs._duplexState & READ_BACKPRESSURE_STATUS) !== 0 || rs._readableState.buffered >= rs._readableState.highWaterMark
}
[asyncIterator] () {

@@ -648,2 +660,6 @@ const stream = this

static isBackpressured (ws) {
return (ws._duplexState & WRITE_BACKPRESSURE_STATUS) !== 0
}
write (data) {

@@ -650,0 +666,0 @@ this._writableState.updateNextTick()

2

package.json
{
"name": "streamx",
"version": "2.0.1",
"version": "2.1.0",
"description": "An iteration of the Node.js core streams with a series of improvements",

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

@@ -148,2 +148,10 @@ # streamx

#### `rs._predestroy()`
A simple hook that is called as soon as the first `stream.destroy()` call is invoked.
Use this in case you need to cancel pending reads (if possible) instead of waiting for them to finish.
Can also be set using `options.predestroy` in the constructor.
#### `rs.destroy([error])`

@@ -202,2 +210,6 @@

#### `bool = Readable.isBackpressured(rs)`
Static method to check if a readable stream is currently under backpressure.
## Writable Stream

@@ -245,2 +257,10 @@

#### `ws._predestroy()`
A simple hook that is called as soon as the first `stream.destroy()` call is invoked.
Use this in case you need to cancel pending writes (if possible) instead of waiting for them to finish.
Can also be set using `options.predestroy` in the constructor.
#### `ws.destroy([error])`

@@ -296,2 +316,6 @@

#### `bool = Writable.isBackpressured(ws)`
Static method to check if a writable stream is currently under backpressure.
## Duplex Stream

@@ -298,0 +322,0 @@

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