# stream-url

> Stream URLs ===========

Latest version **0.2.3** (published 2016-09-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install stream-url
pnpm add stream-url
yarn add stream-url
bun add stream-url
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.3 |
| Published | 2016-09-29 |
| First published | 2015-08-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Victor Grishchenko |
| Maintainers | gritzko |

## Links

- npm: https://www.npmjs.com/package/stream-url
- Repository: https://github.com/gritzko/stream-url
- Homepage: http://github.com/gritzko/stream-url
- Issues: https://github.com/gritzko/stream-url/issues
- npm.io page: https://npm.io/package/stream-url

## Dependencies (1)

- [duplexify](https://npm.io/package/duplexify.md) 3.4.5

## Recent versions

- 0.2.3 (latest) — 2016-09-29
- 0.2.2 — 2016-09-27
- 0.2.1 — 2016-09-26
- 0.1.0 — 2015-12-31
- 0.0.14 — 2015-12-01
- 0.0.12 — 2015-08-25
- 0.0.10 — 2015-08-21
- 0.0.8 — 2015-08-21
- 0.0.6 — 2015-08-21
- 0.0.5 — 2015-08-10
- 0.0.4 — 2015-08-10
- 0.0.3 — 2015-08-10
- 0.0.1 — 2015-08-10

## README

Stream URLs
===========

The package aims to unite two powerful universal concepts: streams and
URLs. `stream-url` encapsulates details of a particular medium and allows
the app to open *data streams to URLs*.
stream-url is a syntactic sugar, in a sense, but it definitely helps to
clear a subsystem's code out of technical details and make it easily
pluggable.

```
    var su = require('stream-url');
    
    // TCP server
    var tcp_server = su.listen('tcp://localhost:1234', (err, serv) => {
        serv.on('connection', stream => {
        ...
        
    // stdin/stdout "client"
    su.connect('std:', (err, stream) => {
        ...
```

[![Build Status](https://travis-ci.org/gritzko/stream-url.svg?branch=master)](https://travis-ci.org/gritzko/stream-url)

## API

* `listen(url [,options] [,callback])` start a server (stream factory)
    listening at the `url`, using `options`. Invoke `callback(err,
    server)` when ready or failed.
    The server will emit a `connection` event for every new
    incoming connection/stream.
* `connect(url [,options] [,callback])` connect to a server at (create
    a stream to) `url`. Invoke `callback(err, stream)` once ready to
    write or failed to connect.
    The stream will emit all the [usual events][stream]:
    `data`, `end`, `error`.

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.

All "real" protocols are defined in separate packages, as those
introduce non-trivial dependencies.

- [x] [server-side WebSocket][su-ws]
- [x] [TCP][su-node]
- [ ] [HTTP][su-node]
- [x] [filesystem sockets][su-node]
- [x] [stdin/stdout][su-node]
- [x] [loopback streams][swarm-bat]

[go]: https://gobyexample.com/channels
[stream]: https://iojs.org/api/stream.html
[test]: test/01_connect_listen.js
[su-ws]: https://github.com/gritzko/stream-url-ws
[su-node]: https://github.com/gritzko/stream-url-node
[swarm-bat]: https://github.com/gritzko/swarm

---
_Source: https://npm.io/package/stream-url · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
