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

stream-url

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-url - npm Package Compare versions

Comparing version 0.0.8 to 0.0.10

2

package.json
{
"name": "stream-url",
"version": "0.0.8",
"version": "0.0.10",
"homepage": "http://github.com/gritzko/stream-url",

@@ -5,0 +5,0 @@ "repository": {

@@ -42,4 +42,10 @@ Stream URLs

This package defines just one fictive URL protocol named `0` which
masquerades local invocations for a stream. The 0 protocol is mostly
useful for connecting componenets locally. It is not that useful for
unit testing as it skips serialization/ deserialization for the sake
of efficiency. See [test/][test] for usage examples.
[go]: https://gobyexample.com/channels
[stream]: https://iojs.org/api/stream.html
[test]: test/01_connect_listen.js

@@ -26,2 +26,6 @@ "use strict";

ZeroServer.prototype.listen = function (url, options, callback){
if (options && options.constructor===Function) {
callback = options;
options = undefined;
}
if (this.id) {

@@ -38,3 +42,5 @@ throw new Error('can listen one id only');

ZeroServer.servers[this.id] = this;
callback(null, this);
if (callback) {
callback(null, this);
}
};

@@ -41,0 +47,0 @@

@@ -19,3 +19,2 @@ "use strict";

module.exports = ZeroStream;
// TODO OpStream hook: data is an Op !!!!!!!!!!!!!!!

@@ -26,4 +25,11 @@ ZeroStream.prototype.on = function (event, callback) {

this.on_data = callback;
while (this.data.length) { // fake buffering
callback(this.data.shift());
try {
while (this.data.length) { // fake buffering
callback(this.data.shift());
}
} catch (ex) {
console.error(ex);
if (this.pair.on_error) {
this.pair.on_error(ex.message);
}
}

@@ -33,3 +39,3 @@ break;

case "end": this.on_end = callback; break;
case "error": /* never happens */ break;
case "error": this.on_error = callback; break;
default:

@@ -43,3 +49,10 @@ throw new Error('unsupported event');

if (this.pair.on_data) {
this.pair.on_data(something);
try {
this.pair.on_data(something);
} catch (ex) {
console.error(ex);
if (this.on_error) {
this.on_error(ex.message);
}
}
} else {

@@ -46,0 +59,0 @@ if (this.pair.data.length>100) {

@@ -49,1 +49,22 @@ "use strict";

});
tape ('1.C receiver fails', function (t) {
su.listen('0:failed', function(err, serv) {
serv.on('connection', function(conn) {
t.pass('incoming connection');
conn.on('data', function (obj) {
t.equal(obj, 'test');
throw new Error('fail');
});
});
});
su.connect('0://failed', function (err, stream) {
stream.on('error', function (msg) {
t.pass('got error');
t.equal(msg, 'fail');
t.end();
});
stream.write('test');
});
});
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