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

bufferedstream

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bufferedstream - npm Package Compare versions

Comparing version 1.4.1 to 1.5.0

4

buffered-stream.js

@@ -88,3 +88,2 @@ var util = require('util');

this.paused = true;
this.emit('pause');
}

@@ -99,3 +98,2 @@ };

this.paused = false;
this.emit('resume');
flushOnNextTick(this);

@@ -177,2 +175,4 @@ }

function flush(stream) {
if (!stream._buffer) return;
var chunk;

@@ -179,0 +179,0 @@ while (stream._buffer.length) {

@@ -5,3 +5,3 @@ {

"description": "A base stream class for node that reliably buffers until next tick",
"version": "1.4.1",
"version": "1.5.0",
"repository": {

@@ -8,0 +8,0 @@ "type": "git",

@@ -57,66 +57,25 @@ var assert = require('assert');

describe('', function () {
var stream, pauseCount, resumeCount;
describe('that is paused', function () {
var stream;
beforeEach(function () {
stream = new BufferedStream;
pauseCount = 0;
resumeCount = 0;
stream.on('pause', function () {
pauseCount += 1;
});
stream.on('resume', function () {
resumeCount += 1;
});
stream.pause();
});
describe('that is not paused', function () {
it('does not emit resume when resumed', function () {
assert.equal(resumeCount, 0);
stream.resume();
assert.equal(resumeCount, 0);
it('only emits "end" after it is resumed', function (done) {
var endWasCalled = false;
stream.on('end', function () {
endWasCalled = true;
});
it('emits pause when paused', function () {
assert.equal(pauseCount, 0);
stream.pause();
assert.equal(pauseCount, 1);
});
});
stream.end();
assert.equal(endWasCalled, false);
describe('that is paused', function () {
beforeEach(function () {
stream.pause();
});
it('does not emit pause when paused again', function () {
assert.equal(pauseCount, 1);
stream.pause();
assert.equal(pauseCount, 1);
});
it('emits resume when resumed', function () {
assert.equal(resumeCount, 0);
setTimeout(function () {
stream.resume();
assert.equal(resumeCount, 1);
});
it('only emits "end" after it is resumed', function (done) {
var endWasCalled = false;
stream.on('end', function () {
endWasCalled = true;
});
stream.end();
assert.equal(endWasCalled, false);
setTimeout(function () {
stream.resume();
setTimeout(function () {
assert.equal(endWasCalled, true);
done();
}, 1);
assert.equal(endWasCalled, true);
done();
}, 1);
});
}, 1);
});

@@ -123,0 +82,0 @@ });

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