@mh-cbon/uri-to-stream

1.0.3 • Public • Published

uri-to-stream

Transforms an uri string to a stream

install

npm i @mh-cbon/uri-to-stream --save

usage

var uriToStream = require('uri-to-stream');

uriToStream.read(__dirname + '/index.js').pipe(process.stdout);
uriToStream.read('http://google.com').pipe(process.stdout);
uriToStream.read('tcp://something.to.read:1337');


uriToStream.write(__dirname + '/test/write').end('tomate');
uriToStream.write('http://google.com').end('yahoo');
uriToStream.write('tcp://something.to.write:1337');

For convenience it also supports Object addresses

var uriToStream = require('uri-to-stream');

uriToStream.read({
  protocol: 'http:',
  port: '8000',
  hostname: '127.0.0.1'
}).pipe(process.stdout);

uriToStream.read({
  port: '8000',
  host: '127.0.0.1'
});

uriToStream.write({
  protocol: 'http:',
  port: '8000',
  hostname: '127.0.0.1'
}).end('tomate');

uriToStream.write({
  port: '8000',
  host: '127.0.0.1'
}).end('yahoo');

todo

  • support ssl

/@mh-cbon/uri-to-stream/

    Package Sidebar

    Install

    npm i @mh-cbon/uri-to-stream

    Weekly Downloads

    3

    Version

    1.0.3

    License

    MIT

    Last publish

    Collaborators

    • mh-cbon