{"_id":"socket.io-pull-stream","_rev":"4652676","name":"socket.io-pull-stream","description":"Pull Streams for socket.io","dist-tags":{"latest":"0.1.5"},"maintainers":[{"name":"mkg20001","email":""}],"time":{"modified":"2026-04-10T20:48:17.000Z","created":"2017-09-02T09:31:49.205Z","0.1.5":"2018-03-07T18:40:06.253Z","0.1.4":"2018-01-31T11:53:34.902Z","0.1.3":"2017-12-06T14:32:46.964Z","0.1.2":"2017-12-06T14:22:42.074Z","0.1.1":"2017-09-06T13:08:16.424Z","0.1.0":"2017-09-02T09:45:24.241Z","0.0.1":"2017-09-02T09:31:49.205Z"},"users":{},"author":{"name":"Maciej Krüger","email":"mkg20001@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/mkg20001/socket.io-pull-stream.git"},"versions":{"0.1.5":{"name":"socket.io-pull-stream","version":"0.1.5","description":"Pull Streams for socket.io","main":"src/index.js","scripts":{"test":"aegir test","lint":"aegir lint","build":"aegir build","test:node":"aegir test -t node","test:browser":"aegir test -t browser","release":"aegir release","release-minor":"aegir release --type minor","release-major":"aegir release --type major","coverage":"aegir coverage","coverage-publish":"aegir coverage -u"},"keywords":["pull-stream","socket.io","stream"],"author":{"name":"Maciej Krüger","email":"mkg20001@gmail.com"},"license":"MIT","dependencies":{"data-queue":"0.0.3","debug":"^3.1.0","pull-stream":"^3.6.2","uuid":"^3.2.1"},"devDependencies":{"aegir":"^13.0.5","chai":"^4.1.2","dirty-chai":"^2.0.1","interface-connection":"^0.3.2","multistream-select":"^0.14.1","socket.io":"^2.0.4"},"repository":{"type":"git","url":"git+https://github.com/mkg20001/socket.io-pull-stream.git"},"bugs":{"url":"https://github.com/mkg20001/socket.io-pull-stream/issues"},"homepage":"https://github.com/mkg20001/socket.io-pull-stream#readme","contributors":[{"name":"Gorka","email":"gorka@aquigorka.com"},{"name":"mkg20001","email":"mkg20001@gmail.com"}],"gitHead":"f00762902056cec663da450a9304cac2dee1729c","_id":"socket.io-pull-stream@0.1.5","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"mkg20001","email":"mkg20001@gmail.com"},"dist":{"shasum":"4e5d282b93635d8bf7780da405d82fc149346710","size":5054,"noattachment":false,"key":"/socket.io-pull-stream/-/socket.io-pull-stream-0.1.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/socket.io-pull-stream/download/socket.io-pull-stream-0.1.5.tgz"},"maintainers":[{"name":"mkg20001","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/socket.io-pull-stream_0.1.5_1520448005408_0.5428167790222078"},"_cnpmcore_publish_time":"2021-12-21T01:36:45.084Z","publish_time":1520448006253,"_cnpm_publish_time":1520448006253},"0.1.4":{"name":"socket.io-pull-stream","version":"0.1.4","description":"Pull Streams for socket.io","main":"src/index.js","scripts":{"test":"aegir test","lint":"aegir lint","build":"aegir build","test:node":"aegir test -t node","test:browser":"aegir test -t browser","release":"aegir release","release-minor":"aegir release --type minor","release-major":"aegir release --type major","coverage":"aegir coverage","coverage-publish":"aegir coverage -u"},"keywords":["pull-stream","socket.io","stream"],"author":{"name":"Maciej Krüger","email":"mkg20001@gmail.com"},"license":"MIT","dependencies":{"data-queue":"0.0.3","debug":"^3.1.0","pull-stream":"^3.6.1","uuid":"^3.2.1"},"devDependencies":{"aegir":"^12.4.0","chai":"^4.1.2","dirty-chai":"^2.0.1","interface-connection":"^0.3.2","multistream-select":"^0.14.1","socket.io":"^2.0.4"},"repository":{"type":"git","url":"git+https://github.com/mkg20001/socket.io-pull-stream.git"},"bugs":{"url":"https://github.com/mkg20001/socket.io-pull-stream/issues"},"homepage":"https://github.com/mkg20001/socket.io-pull-stream#readme","contributors":[{"name":"Gorka","email":"gorka@aquigorka.com"},{"name":"mkg20001","email":"mkg20001@gmail.com"}],"gitHead":"275a3c0023fe12898336e0c43fd5b0e758245fa6","_id":"socket.io-pull-stream@0.1.4","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"mkg20001","email":"mkg20001@gmail.com"},"dist":{"shasum":"a56123e185fcfbea9f2cdf2f67161058c4653d4c","size":4667,"noattachment":false,"key":"/socket.io-pull-stream/-/socket.io-pull-stream-0.1.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/socket.io-pull-stream/download/socket.io-pull-stream-0.1.4.tgz"},"maintainers":[{"name":"mkg20001","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/socket.io-pull-stream-0.1.4.tgz_1517399614813_0.2754513758700341"},"directories":{},"_cnpmcore_publish_time":"2021-12-21T01:36:44.997Z","publish_time":1517399614902,"_cnpm_publish_time":1517399614902},"0.1.3":{"name":"socket.io-pull-stream","version":"0.1.3","description":"Pull Streams for socket.io","main":"src/index.js","scripts":{"test":"aegir test","lint":"aegir lint","build":"aegir build","test:node":"aegir test -t node","test:browser":"aegir test -t browser","release":"aegir release","release-minor":"aegir release --type minor","release-major":"aegir release --type major","coverage":"aegir coverage","coverage-publish":"aegir coverage -u"},"keywords":["pull-stream","socket.io","stream"],"author":{"name":"Maciej Krüger","email":"mkg20001@gmail.com"},"license":"MIT","dependencies":{"data-queue":"0.0.3","debug":"^3.1.0","pull-stream":"^3.6.1","uuid":"^3.1.0"},"devDependencies":{"aegir":"^12.2.0","chai":"^4.1.2","dirty-chai":"^2.0.1","interface-connection":"^0.3.2","multistream-select":"^0.14.1","socket.io":"^2.0.4"},"repository":{"type":"git","url":"git+https://github.com/mkg20001/socket.io-pull-stream.git"},"bugs":{"url":"https://github.com/mkg20001/socket.io-pull-stream/issues"},"homepage":"https://github.com/mkg20001/socket.io-pull-stream#readme","contributors":[{"name":"mkg20001","email":"mkg20001@gmail.com"}],"gitHead":"a60a56d4181bf68df9c3567a84443dbb9c9812b8","_id":"socket.io-pull-stream@0.1.3","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"mkg20001","email":"mkg20001@gmail.com"},"dist":{"shasum":"23d9bae878093f6c0397e4599250e7ac6f61ced7","size":4653,"noattachment":false,"key":"/socket.io-pull-stream/-/socket.io-pull-stream-0.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/socket.io-pull-stream/download/socket.io-pull-stream-0.1.3.tgz"},"maintainers":[{"name":"mkg20001","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/socket.io-pull-stream-0.1.3.tgz_1512570766069_0.18834458966739476"},"directories":{},"_cnpmcore_publish_time":"2021-12-21T01:36:44.121Z","publish_time":1512570766964,"_cnpm_publish_time":1512570766964},"0.1.2":{"name":"socket.io-pull-stream","version":"0.1.2","description":"Pull Streams for socket.io","main":"index.js","scripts":{"test":"aegir test","lint":"aegir lint","build":"aegir build","test:node":"aegir test -t node","test:browser":"aegir test -t browser","release":"aegir release","release-minor":"aegir release --type minor","release-major":"aegir release --type major","coverage":"aegir coverage","coverage-publish":"aegir coverage -u"},"keywords":["pull-stream","socket.io","stream"],"author":{"name":"Maciej Krüger","email":"mkg20001@gmail.com"},"license":"MIT","dependencies":{"data-queue":"0.0.3","debug":"^3.1.0","pull-stream":"^3.6.1","uuid":"^3.1.0"},"devDependencies":{"aegir":"^12.2.0","chai":"^4.1.2","dirty-chai":"^2.0.1","interface-connection":"^0.3.2","multistream-select":"^0.14.1","socket.io":"^2.0.4"},"repository":{"type":"git","url":"git+https://github.com/mkg20001/socket.io-pull-stream.git"},"bugs":{"url":"https://github.com/mkg20001/socket.io-pull-stream/issues"},"homepage":"https://github.com/mkg20001/socket.io-pull-stream#readme","contributors":[{"name":"mkg20001","email":"mkg20001@gmail.com"}],"gitHead":"cfe50460ec209b9827833cfd50ab567d98080c9b","_id":"socket.io-pull-stream@0.1.2","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"mkg20001","email":"mkg20001@gmail.com"},"dist":{"shasum":"6d6f4581cd38504c99fa00b163bce744e4552e0b","size":4622,"noattachment":false,"key":"/socket.io-pull-stream/-/socket.io-pull-stream-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/socket.io-pull-stream/download/socket.io-pull-stream-0.1.2.tgz"},"maintainers":[{"name":"mkg20001","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/socket.io-pull-stream-0.1.2.tgz_1512570161229_0.9012035194318742"},"directories":{},"_cnpmcore_publish_time":"2021-12-21T01:36:43.218Z","publish_time":1512570162074,"_cnpm_publish_time":1512570162074},"0.1.1":{"name":"socket.io-pull-stream","version":"0.1.1","description":"Pull Streams for socket.io","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["pull-stream","socket.io","stream"],"author":{"name":"Maciej Krüger","email":"mkg20001@gmail.com"},"license":"MIT","dependencies":{"data-queue":"0.0.2","debug":"^3.0.1","pull-stream":"^3.6.0","uuid":"^3.1.0"},"devDependencies":{},"repository":{"type":"git","url":"git+https://github.com/mkg20001/socket.io-pull-stream.git"},"bugs":{"url":"https://github.com/mkg20001/socket.io-pull-stream/issues"},"homepage":"https://github.com/mkg20001/socket.io-pull-stream#readme","gitHead":"ec461a8782b7522ad2f8ddd0ec09bb46067b51ec","_id":"socket.io-pull-stream@0.1.1","_npmVersion":"5.3.0","_nodeVersion":"8.4.0","_npmUser":{"name":"mkg20001","email":"mkg20001@gmail.com"},"dist":{"shasum":"ea17dcfd2bb2404f5285769ee824650c8a7f3e7f","size":2189,"noattachment":false,"key":"/socket.io-pull-stream/-/socket.io-pull-stream-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/socket.io-pull-stream/download/socket.io-pull-stream-0.1.1.tgz"},"maintainers":[{"name":"mkg20001","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/socket.io-pull-stream-0.1.1.tgz_1504703295482_0.13973300927318633"},"directories":{},"_cnpmcore_publish_time":"2021-12-21T01:36:42.356Z","publish_time":1504703296424,"_cnpm_publish_time":1504703296424},"0.1.0":{"name":"socket.io-pull-stream","version":"0.1.0","description":"Pull Streams for socket.io","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["pull-stream","socket.io","stream"],"author":{"name":"Maciej Krüger","email":"mkg20001@gmail.com"},"license":"MIT","dependencies":{"data-queue":"0.0.2","debug":"^3.0.1","pull-stream":"^3.6.0","uuid":"^3.1.0"},"devDependencies":{},"repository":{"type":"git","url":"git+https://github.com/mkg20001/socket.io-pull-stream.git"},"bugs":{"url":"https://github.com/mkg20001/socket.io-pull-stream/issues"},"homepage":"https://github.com/mkg20001/socket.io-pull-stream#readme","gitHead":"2514dfc2b0da5981097944e07d198bad3b100673","_id":"socket.io-pull-stream@0.1.0","_npmVersion":"5.3.0","_nodeVersion":"8.4.0","_npmUser":{"name":"mkg20001","email":"mkg20001@gmail.com"},"dist":{"shasum":"6ef378ecd4bf1df3d21f5e77d8c839aa4e4ce450","size":1779,"noattachment":false,"key":"/socket.io-pull-stream/-/socket.io-pull-stream-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/socket.io-pull-stream/download/socket.io-pull-stream-0.1.0.tgz"},"maintainers":[{"name":"mkg20001","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/socket.io-pull-stream-0.1.0.tgz_1504345522905_0.0610293282661587"},"directories":{},"_cnpmcore_publish_time":"2021-12-21T01:36:41.496Z","publish_time":1504345524241,"_cnpm_publish_time":1504345524241},"0.0.1":{"name":"socket.io-pull-stream","version":"0.0.1","description":"Pull Streams for socket.io","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["pull-stream","socket.io","stream"],"author":{"name":"Maciej Krüger","email":"mkg20001@gmail.com"},"license":"MIT","dependencies":{"data-queue":"0.0.2","pull-stream":"^3.6.0"},"_id":"socket.io-pull-stream@0.0.1","_npmVersion":"5.3.0","_nodeVersion":"8.4.0","_npmUser":{"name":"mkg20001","email":"mkg20001@gmail.com"},"dist":{"shasum":"4a38094bf8e831561f354330a8147617dba09fda","size":1129,"noattachment":false,"key":"/socket.io-pull-stream/-/socket.io-pull-stream-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/socket.io-pull-stream/download/socket.io-pull-stream-0.0.1.tgz"},"maintainers":[{"name":"mkg20001","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/socket.io-pull-stream-0.0.1.tgz_1504344708278_0.11296604038216174"},"directories":{},"_cnpmcore_publish_time":"2021-12-21T01:36:40.623Z","publish_time":1504344709205,"_cnpm_publish_time":1504344709205}},"readme":"# socket.io-pull-stream\n\nPull Streams for socket.io\n\n# API\n\n-   `sp(io[, opt])`\n\n    Will add the functions below to `io`\n\n    -   `io`: Socket.io-client instance\n\n    -   `opt`: Default options for every stream\n\n-   `.createSink([id, opt])`\n\n    Will create a sink with `id`.\n    If no id is provided a new id will be generated and can be found under `sink.id`\n\n    -   `opt`: Object. Config for stream\n\n        -   `codec`: Codec to use.\n\n            Either string (`hex, plain, buffer`) or object (`{encode: data => ..., decode: data => ...}`).\n\n            Default: `plain`\n\n    Returns: Sink Function\n\n-   `.createSource(id[, opt])`\n\n    Will create a source that reads from a sink with id `id` on the other side.\n\n    -   `opt`: Object. Config for stream\n\n        -   `codec`: Codec to use.\n\n            Either string (`hex, plain, buffer`) or object (`{encode: data => ..., decode: data => ...}`).\n\n            Default: `plain`\n\n    Returns: Source Function\n\n-   `.createProxy(id, to)`\n\n    Will proxy the stream `id` to socket `to`\n\n# Examples\n\n## File Stream\n\nServer:\n\n```js\nconst sp = require('socket.io-pull-stream')\nconst fs = require('fs')\nconst toPull = require('stream-to-pull-stream')\nconst pull = require('pull-stream')\n\nio.on('connection', client => {\n  sp(client)\n  const ws = toPull.source(fs.createReadStream('some_file.txt'))\n  const sink = client.createSink()\n  client.emit('file', sink.id) // to send the stream just emit the id (IMPORTANT: EMIT THE ID FIRST, LATER CREATE THE SOURCE IN SYNC)\n  pull(\n    ws,\n    sink\n  )\n})\n```\n\nClient:\n\n```js\nconst sp = require('socket.io-pull-stream')\nconst pull = require('pull-stream')\n\nsp(io)\n\nio.on('file', id => {\n  pull(\n    io.createSource(id), // to recieve just create a source with the id (IMPORTANT: DO THAT SYNC)\n    pull.collect((err, data) => {\n      if (err) throw err\n      console.log(Buffer.from(data).toString()) // our data\n    })\n  )\n})\n```\n\nTo send streams between clients the stream need to be proxied\n\n```js\n// TODO :add\n```\n","_attachments":{},"homepage":"https://github.com/mkg20001/socket.io-pull-stream#readme","bugs":{"url":"https://github.com/mkg20001/socket.io-pull-stream/issues"},"license":"MIT"}