{"id":13624860,"url":"https://github.com/dominictarr/browser-stream","last_synced_at":"2025-12-30T02:02:48.454Z","repository":{"id":3019122,"uuid":"4038614","full_name":"dominictarr/browser-stream","owner":"dominictarr","description":"open pipable streams to and from the browser, with Socket.io","archived":false,"fork":false,"pushed_at":"2012-06-26T11:10:34.000Z","size":152,"stargazers_count":55,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-15T14:23:20.172Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dominictarr.png","metadata":{"files":{"readme":"readme.markdown","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-04-16T07:36:40.000Z","updated_at":"2022-09-30T19:20:50.000Z","dependencies_parsed_at":"2022-08-28T13:21:22.407Z","dependency_job_id":null,"html_url":"https://github.com/dominictarr/browser-stream","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dominictarr%2Fbrowser-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dominictarr%2Fbrowser-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dominictarr%2Fbrowser-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dominictarr%2Fbrowser-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dominictarr","download_url":"https://codeload.github.com/dominictarr/browser-stream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234296370,"owners_count":18809988,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T21:01:47.342Z","updated_at":"2025-09-26T06:30:44.600Z","avatar_url":"https://github.com/dominictarr.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# BrowserStream\n\nuse `Stream#pipe` to send data to clients or servers.\n\nwrap `socket.io` (or another web socket abstraction that gives a remote `EventEmitter` api)\nwith a interface for creating streams.\n\n### DEPRECIATED\n\nuse [mux-demux](http://github.com/dominictarr/mux-demux) with [shoe](http://github.com/substack/shoe)\n\nI'm not gonna use or maintain this any more. If you want to use and maintain this module email me and I'll\nadd you as owner.\n\n## install\n\n```\nnpm install browser-stream\n\n```\n\n## example\n\n### client \n\n``` js\n  var bs = require('browser-stream')(io.connect('http://localhost:3000'))\n  var domnode = require('domnode') //see https://github.com/maxogden/dominode\n  var opts = {options: 'pass an optional object with the createReadStream message. maybe useful!'})\n  //pipe the 'whatever' stream to the dom with dominode.\n  bs.createReadStream('whatever', options)\n    .on('error', function (err) {\n      //unexpected disconnect\n      console.error(err)\n    })\n    .pipe(domnode('#list', '\u003cli id=\"item\"\u003e\u003c/li\u003e'))\n\n```\n\n### server\n\n``` js\n\nio = io.listen(app) //see https://github.com/LearnBoost/socket.io\nvar _bs = require('browser-stream')\n\nio.sockets.on('connection', function (sock) {\n\n  var bs = _bs(sock) \n\n  var whatever = new Stream() // SOME KIND OF STREAM\n  bs.on('connection', function (stream, opts) {\n    if(stream.name == 'whatever') \n      whatever.pipe(stream)\n    //stream.options -- will be the same as `opts` from the client side!\n    stream.on('error', function (err) {\n      //the client has unexpectedly disconnected. tidy up!\n      console.error(err)\n    })\n  })\n\n}\n\n```\n\nthis will connect `whatever` to the `Dominode` stream, rendering it, in the browser!\n\n## API\n\n``` js\n\nvar _bs = require('browser-stream')\n\nio.sockets.on('connection', function (sock) {\n  var bs = _bs(sock)\n  bs.on('connection', function (stream) {\n    //stream is a pipable node.js `Stream` instance\n  })\n})\n\n```\n\n### createReadStream (name, options)\n\n\n\nopen a `ReadableStream` from the other side.\nreturns a `ReadableStream`.\nthe other side of connection will emit a writable stream that is connected to this stream.\n\n### createWriteStream (name, options)\n\nopen a `WritableStream` to the other side.\nreturns a `WritableStream`, the other side will emit a `ReadableStream` connected to this stream.\n\n### createStream (name, options)\n\nopen a `Stream` to the other side which is both readable and writable.\nreturns a `Stream`, the other side will emit a `Stream` connected to this stream.\n\n\u003e note to self, references to a class (`Stream`) should be capitalized, and in backticks.\n\u003e references to an instance should be lowercase, and not in backticks unless refuring to\n\u003e a specific variable in a code example.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdominictarr%2Fbrowser-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdominictarr%2Fbrowser-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdominictarr%2Fbrowser-stream/lists"}