Socket
Socket
Sign inDemoInstall

hyperstream

Package Overview
Dependencies
5
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 0.1.1

test/string_stream.js

48

index.js
var trumpet = require('trumpet');
var pause = require('pause-stream');
var through = require('through');
var duplexer = require('duplexer');

@@ -11,3 +11,5 @@

var tr = trumpet();
var output = tr.pipe(upto());
tr.on('data', function () {});
tr.on('end', function () {

@@ -18,6 +20,19 @@ if (!active && stack.length === 0) output.to(-1);

var streams = Object.keys(streamMap).reduce(function (acc, key) {
if (streamMap[key] && typeof streamMap[key] === 'object') {
var stream = streamMap[key].pipe(pause());
var sm = streamMap[key];
if (sm && typeof sm === 'object') {
var stream = sm.pipe(through());
acc[key] = stream.pause();
}
if (typeof sm === 'function') {
}
if (!sm || typeof sm !== 'object') {
var stream = through();
acc[key] = stream.pause();
if (typeof sm === 'function') {
stream.queue(String(
}
else stream.queue(String(sm));
stream.queue(null);
}
return acc;

@@ -30,9 +45,2 @@ }, {});

Object.keys(streamMap).forEach(function (key) {
if (typeof streamMap[key] === 'function') {
return tr.update(key, streamMap[key]);
}
if (!streamMap[key] || typeof streamMap[key] !== 'object') {
return tr.update(key, String(streamMap[key]));
}
tr.select(key, function () {

@@ -45,14 +53,12 @@ onupdate(tr.parser.position);

streams[key].on('data', function (buf) {
output.emit('data', buf);
});
streams[key].on('end', function (buf) {
active = false;
if (stack.length) {
stack.shift()()
streams[key].pipe(through(
function (buf) { output.queue(buf) },
function () {
active = false;
if (stack.length) {
stack.shift()()
}
else output.to(-1)
}
else output.to(-1)
});
));
active = true;

@@ -59,0 +65,0 @@

@@ -14,6 +14,6 @@ var through = require('through');

for (var i = 0; i < buffer.length; i++) {
tr.emit('data', buffer[i]);
tr.queue(buffer[i]);
}
buffer.splice(0);
if (caughtEnd) tr.emit('end');
if (caughtEnd) tr.queue(null);
return;

@@ -29,7 +29,7 @@ }

bytes += buf.length;
tr.emit('data', buffer[i]);
tr.queue(buffer[i]);
}
else {
bytes = to;
tr.emit('data', buf.slice(0, buf.length - to + bytes));
tr.queue(buf.slice(0, buf.length - to + bytes));
buffer.splice(0, i + 1, buf.slice(buf.length - to + bytes));

@@ -49,3 +49,3 @@ return;

bytes = to;
tr.emit('data', buf.slice(0, buf.length - to + bytes));
tr.queue(buf.slice(0, buf.length - to + bytes));
buffer.push(buf.slice(buf.length - to + bytes));

@@ -55,3 +55,3 @@ }

bytes += buf.length;
tr.emit('data', buf);
tr.queue(buf);
}

@@ -58,0 +58,0 @@ }

{
"name" : "hyperstream",
"version" : "0.1.0",
"version" : "0.1.1",
"description" : "stream html into html at a css selector",
"main" : "index.js",
"dependencies" : {
"trumpet" : "~0.3.1",
"pause-stream" : "~0.0.6",
"trumpet" : "~0.3.5",
"duplexer" : "~0.0.2",
"through" : "~2.1.0"
"through" : "~2.3.4"
},
"devDependencies" : {
"tap" : "~0.3.0"
"tap" : "~0.4.0",
"concat-stream" : "~0.1.1"
},

@@ -15,0 +15,0 @@ "scripts" : {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc