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

writable-consumable-stream

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

writable-consumable-stream - npm Package Compare versions

Comparing version 3.0.1 to 4.0.0

13

consumer.js

@@ -39,6 +39,10 @@ class Consumer {

clearActiveTimeout() {
clearTimeout(this._timeoutId);
delete this._timeoutId;
}
write(packet) {
if (this._timeoutId !== undefined) {
clearTimeout(this._timeoutId);
delete this._timeoutId;
this.clearActiveTimeout(packet);
}

@@ -53,7 +57,6 @@ this.applyBackpressure(packet);

kill(value) {
this._killPacket = {value, done: true};
if (this._timeoutId !== undefined) {
clearTimeout(this._timeoutId);
delete this._timeoutId;
this.clearActiveTimeout(this._killPacket);
}
this._killPacket = {value, done: true};
this._destroy();

@@ -60,0 +63,0 @@

{
"name": "writable-consumable-stream",
"version": "3.0.1",
"version": "4.0.0",
"description": "An async stream which can be iterated over using a for-await-of loop.",

@@ -30,4 +30,4 @@ "main": "index.js",

"dependencies": {
"consumable-stream": "^2.0.0"
"consumable-stream": "^3.0.0"
}
}

@@ -461,3 +461,3 @@ const WritableConsumableStream = require('../index');

it('should cancel timeout when stream is killed', async () => {
it('should throw a timeout error early when stream is killed', async () => {
(async () => {

@@ -471,7 +471,14 @@ await wait(10);

await Promise.race([
stream.once(50), // This should not throw an error.
wait(100) // This one should execute first.
]);
let error;
try {
await Promise.race([
stream.once(200), // This should throw an error early.
wait(100)
]);
} catch (err) {
error = err;
}
assert.equal(error.name, 'TimeoutError');
let backpressure = stream.getBackpressure();

@@ -478,0 +485,0 @@ assert.equal(backpressure, 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