Socket
Socket
Sign inDemoInstall

streamx

Package Overview
Dependencies
Maintainers
1
Versions
62
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.15.8 to 2.16.0

78

index.js

@@ -10,4 +10,4 @@ const { EventEmitter } = require('events')

// 27 bits used total (4 from shared, 13 from read, and 10 from write)
const MAX = ((1 << 27) - 1)
// 28 bits used total (4 from shared, 14 from read, and 10 from write)
const MAX = ((1 << 28) - 1)

@@ -24,15 +24,16 @@ // Shared state

// Read state (4 bit offset from shared state)
const READ_ACTIVE = 0b0000000000001 << 4
const READ_UPDATING = 0b0000000000010 << 4
const READ_PRIMARY = 0b0000000000100 << 4
const READ_QUEUED = 0b0000000001000 << 4
const READ_RESUMED = 0b0000000010000 << 4
const READ_PIPE_DRAINED = 0b0000000100000 << 4
const READ_ENDING = 0b0000001000000 << 4
const READ_EMIT_DATA = 0b0000010000000 << 4
const READ_EMIT_READABLE = 0b0000100000000 << 4
const READ_EMITTED_READABLE = 0b0001000000000 << 4
const READ_DONE = 0b0010000000000 << 4
const READ_NEXT_TICK = 0b0100000000000 << 4
const READ_NEEDS_PUSH = 0b1000000000000 << 4
const READ_ACTIVE = 0b00000000000001 << 4
const READ_UPDATING = 0b00000000000010 << 4
const READ_PRIMARY = 0b00000000000100 << 4
const READ_QUEUED = 0b00000000001000 << 4
const READ_RESUMED = 0b00000000010000 << 4
const READ_PIPE_DRAINED = 0b00000000100000 << 4
const READ_ENDING = 0b00000001000000 << 4
const READ_EMIT_DATA = 0b00000010000000 << 4
const READ_EMIT_READABLE = 0b00000100000000 << 4
const READ_EMITTED_READABLE = 0b00001000000000 << 4
const READ_DONE = 0b00010000000000 << 4
const READ_NEXT_TICK = 0b00100000000000 << 4
const READ_NEEDS_PUSH = 0b01000000000000 << 4
const READ_READ_AHEAD = 0b10000000000000 << 4

@@ -44,2 +45,3 @@ // Combined read state

const READ_EMIT_READABLE_AND_QUEUED = READ_EMIT_READABLE | READ_QUEUED
const READ_RESUMED_READ_AHEAD = READ_RESUMED | READ_READ_AHEAD

@@ -56,14 +58,16 @@ const READ_NOT_ACTIVE = MAX ^ READ_ACTIVE

const READ_NOT_UPDATING = MAX ^ READ_UPDATING
const READ_NO_READ_AHEAD = MAX ^ READ_READ_AHEAD
const READ_PAUSED_NO_READ_AHEAD = MAX ^ READ_RESUMED_READ_AHEAD
// Write state (17 bit offset, 4 bit offset from shared state and 13 from read state)
const WRITE_ACTIVE = 0b0000000001 << 17
const WRITE_UPDATING = 0b0000000010 << 17
const WRITE_PRIMARY = 0b0000000100 << 17
const WRITE_QUEUED = 0b0000001000 << 17
const WRITE_UNDRAINED = 0b0000010000 << 17
const WRITE_DONE = 0b0000100000 << 17
const WRITE_EMIT_DRAIN = 0b0001000000 << 17
const WRITE_NEXT_TICK = 0b0010000000 << 17
const WRITE_WRITING = 0b0100000000 << 17
const WRITE_FINISHING = 0b1000000000 << 17
// Write state (18 bit offset, 4 bit offset from shared state and 13 from read state)
const WRITE_ACTIVE = 0b0000000001 << 18
const WRITE_UPDATING = 0b0000000010 << 18
const WRITE_PRIMARY = 0b0000000100 << 18
const WRITE_QUEUED = 0b0000001000 << 18
const WRITE_UNDRAINED = 0b0000010000 << 18
const WRITE_DONE = 0b0000100000 << 18
const WRITE_EMIT_DRAIN = 0b0001000000 << 18
const WRITE_NEXT_TICK = 0b0010000000 << 18
const WRITE_WRITING = 0b0100000000 << 18
const WRITE_FINISHING = 0b1000000000 << 18

@@ -95,3 +99,3 @@ const WRITE_NOT_ACTIVE = MAX ^ (WRITE_ACTIVE | WRITE_WRITING)

const READ_READABLE_STATUS = OPEN_STATUS | READ_EMIT_READABLE | READ_QUEUED | READ_EMITTED_READABLE
const SHOULD_NOT_READ = OPEN_STATUS | READ_ACTIVE | READ_ENDING | READ_DONE | READ_NEEDS_PUSH
const SHOULD_NOT_READ = OPEN_STATUS | READ_ACTIVE | READ_ENDING | READ_DONE | READ_NEEDS_PUSH | READ_READ_AHEAD
const READ_BACKPRESSURE_STATUS = DESTROY_STATUS | READ_ENDING | READ_DONE

@@ -239,4 +243,5 @@ const READ_UPDATE_SYNC_STATUS = READ_UPDATING | OPEN_STATUS | READ_NEXT_TICK | READ_PRIMARY

this.queue = new FIFO()
this.highWaterMark = highWaterMark
this.highWaterMark = highWaterMark === 0 ? 1 : highWaterMark
this.buffered = 0
this.readAhead = highWaterMark > 0
this.error = null

@@ -331,2 +336,7 @@ this.pipeline = null

if (this.readAhead === false) {
stream._duplexState |= READ_READ_AHEAD
this.updateNextTick()
}
return null

@@ -353,3 +363,3 @@ }

while (this.buffered < this.highWaterMark && (stream._duplexState & SHOULD_NOT_READ) === 0) {
while (this.buffered < this.highWaterMark && (stream._duplexState & SHOULD_NOT_READ) === READ_READ_AHEAD) {
stream._duplexState |= READ_ACTIVE_AND_NEEDS_PUSH

@@ -527,2 +537,3 @@ stream._read(this.afterRead)

this.stream._duplexState &= READ_NOT_ACTIVE
if (this.readAhead === false && (this.stream._duplexState & READ_RESUMED) === 0) this.stream._duplexState &= READ_NO_READ_AHEAD
this.updateCallback()

@@ -585,3 +596,3 @@ }

if (name === 'data') {
this._duplexState |= (READ_EMIT_DATA | READ_RESUMED)
this._duplexState |= (READ_EMIT_DATA | READ_RESUMED_READ_AHEAD)
this._readableState.updateNextTick()

@@ -679,6 +690,7 @@ }

this._duplexState |= OPENING | WRITE_DONE
this._duplexState |= OPENING | WRITE_DONE | READ_READ_AHEAD
this._readableState = new ReadableState(this, opts)
if (opts) {
if (this._readableState.readAhead === false) this._duplexState &= READ_NO_READ_AHEAD
if (opts.read) this._read = opts.read

@@ -715,3 +727,3 @@ if (opts.eagerOpen) this._readableState.updateNextTick()

resume () {
this._duplexState |= READ_RESUMED
this._duplexState |= READ_RESUMED_READ_AHEAD
this._readableState.updateNextTick()

@@ -722,3 +734,3 @@ return this

pause () {
this._duplexState &= READ_PAUSED
this._duplexState &= (this._readableState.readAhead === false ? READ_PAUSED_NO_READ_AHEAD : READ_PAUSED)
return this

@@ -725,0 +737,0 @@ }

{
"name": "streamx",
"version": "2.15.8",
"version": "2.16.0",
"description": "An iteration of the Node.js core streams with a series of improvements",

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

@@ -125,2 +125,5 @@ # streamx

If you set highWaterMark to `0` then all read ahead buffering on the stream
is disabled and it will only call `_read` when a user reads rather than ahead of time.
#### `rs._read(cb)`

@@ -127,0 +130,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