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

stream-url-node

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-url-node

[stream-url][su] marries streams and urls.

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Node API adapters for stream-url (TCP)

stream-url marries streams and urls.

This package implements protocol adapters for all kinds of streams Node.js API provides access to.

  • TCP, tcp://address:port
  • filesystem sockets
  • UDP
  • HTTP
  • stdin/stdout

API user can start a server or a client connection using an ultra-compact universal interface of two methods: listen and connect.

// Server

var su = require('stream-url-node');

// start a WebSocket echo server
su.listen ('tcp://localhost:1234', function ready(err, server) {

    if (err) {
        console.error(err);
        return;
    }

    server.on('connection', function (stream) {

        stream.on('data', stream.write.bind(stream));

    })

});


// Client

var su = require('stream-url-ws');

su.connect('tcp://localhost:1234', function ready(err, stream) {

    stream.on ('data', function log (data) {
        console.log(''+data);
        stream.end();
    });

    stream.write('Hello world!');

});

FAQs

Package last updated on 31 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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