{"_id":"multibuffer-stream","_rev":"4665384","name":"multibuffer-stream","description":"A streaming interface for multibuffer.","dist-tags":{"latest":"3.0.0"},"maintainers":[{"name":"bryce","email":""}],"time":{"modified":"2026-04-10T22:37:41.000Z","created":"2013-10-01T06:17:13.982Z","3.0.0":"2015-01-15T23:41:24.141Z","2.1.1":"2014-01-31T00:42:31.557Z","2.1.0":"2013-12-19T00:00:45.530Z","2.0.1":"2013-12-13T19:14:26.210Z","2.0.0":"2013-10-10T23:27:53.039Z","1.0.1":"2013-10-04T21:14:41.680Z","1.0.0":"2013-10-01T06:17:13.982Z"},"users":{},"author":{"name":"Bryce B. Baril"},"repository":{"type":"git","url":"git://github.com/brycebaril/multibuffer-stream.git"},"versions":{"3.0.0":{"name":"multibuffer-stream","version":"3.0.0","description":"A streaming interface for multibuffer.","main":"index.js","directories":{"test":"test"},"dependencies":{"multibuffer":"~2.2.3","through2":"~0.6.3","varint":"~4.0.0"},"devDependencies":{"tape":"~3.2.0","stream-spigot":"~3.0.4","terminus":"~1.0.11"},"scripts":{"test":"node test/"},"keywords":["buffers","encoding","transport","stream"],"author":{"name":"Bryce B. Baril"},"license":"MIT","repository":{"type":"git","url":"git://github.com/brycebaril/multibuffer-stream.git"},"bugs":{"url":"https://github.com/brycebaril/multibuffer-stream/issues"},"gitHead":"a54aff042e64caad5e7041e885a5751a2201ebd3","homepage":"https://github.com/brycebaril/multibuffer-stream","_id":"multibuffer-stream@3.0.0","_shasum":"7e0523d26647babc11ba42093041b3d1e492ae9b","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"dist":{"shasum":"7e0523d26647babc11ba42093041b3d1e492ae9b","size":2391,"noattachment":false,"key":"/multibuffer-stream/-/multibuffer-stream-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/multibuffer-stream/download/multibuffer-stream-3.0.0.tgz"},"publish_time":1421365284141,"_hasShrinkwrap":false,"_cnpm_publish_time":1421365284141,"_cnpmcore_publish_time":"2021-12-16T22:24:27.153Z"},"2.1.1":{"name":"multibuffer-stream","version":"2.1.1","description":"A streaming interface for multibuffer.","main":"index.js","directories":{"test":"test"},"dependencies":{"multibuffer":"~2.2.1","through2":"~0.4.1"},"devDependencies":{"tape":"~2.4.0","stream-spigot":"~3.0.3","terminus":"~1.0.9"},"scripts":{"test":"node test/"},"keywords":["buffers","encoding","transport","stream"],"author":{"name":"Bryce B. Baril"},"license":"MIT","repository":{"type":"git","url":"git://github.com/brycebaril/multibuffer-stream.git"},"bugs":{"url":"https://github.com/brycebaril/multibuffer-stream/issues"},"homepage":"https://github.com/brycebaril/multibuffer-stream","_id":"multibuffer-stream@2.1.1","dist":{"shasum":"e5a9e6de19d9abb853a7d899f777003d50a9c2a2","size":2090,"noattachment":false,"key":"/multibuffer-stream/-/multibuffer-stream-2.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/multibuffer-stream/download/multibuffer-stream-2.1.1.tgz"},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"publish_time":1391128951557,"_hasShrinkwrap":false,"_cnpm_publish_time":1391128951557,"_cnpmcore_publish_time":"2021-12-16T22:24:27.418Z"},"2.1.0":{"name":"multibuffer-stream","version":"2.1.0","description":"A streaming interface for multibuffer.","main":"index.js","directories":{"test":"test"},"dependencies":{"multibuffer":"~2.2.0","through2":"~0.2.3"},"devDependencies":{"tape":"~2.3.2","stream-spigot":"~3.0.2","terminus":"~1.0.7"},"scripts":{"test":"node test/"},"keywords":["buffers","encoding","transport","stream"],"author":{"name":"Bryce B. Baril"},"license":"MIT","repository":{"type":"git","url":"git://github.com/brycebaril/multibuffer-stream.git"},"bugs":{"url":"https://github.com/brycebaril/multibuffer-stream/issues"},"readmeFilename":"README.md","homepage":"https://github.com/brycebaril/multibuffer-stream","_id":"multibuffer-stream@2.1.0","dist":{"shasum":"b3c4ed4c9d7896a320e7166f3031e7dab98eab7d","size":2097,"noattachment":false,"key":"/multibuffer-stream/-/multibuffer-stream-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/multibuffer-stream/download/multibuffer-stream-2.1.0.tgz"},"_from":".","_npmVersion":"1.3.21","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"publish_time":1387411245530,"_hasShrinkwrap":false,"_cnpm_publish_time":1387411245530,"_cnpmcore_publish_time":"2021-12-16T22:24:27.583Z"},"2.0.1":{"name":"multibuffer-stream","version":"2.0.1","description":"A streaming interface for multibuffer.","main":"index.js","directories":{"test":"test"},"dependencies":{"multibuffer":"~2.1.0","through2":"~0.2.3","bops":"~0.1.1"},"devDependencies":{"tape":"~2.3.0","stream-spigot":"~3.0.1","terminus":"~1.0.4"},"scripts":{"test":"node test/"},"keywords":["buffers","encoding","transport","stream"],"author":{"name":"Bryce B. Baril"},"license":"MIT","repository":{"type":"git","url":"git://github.com/brycebaril/multibuffer-stream.git"},"bugs":{"url":"https://github.com/brycebaril/multibuffer-stream/issues"},"readmeFilename":"README.md","homepage":"https://github.com/brycebaril/multibuffer-stream","_id":"multibuffer-stream@2.0.1","dist":{"shasum":"e8000a6e95fc619bcc92abbe6840ec71ea196492","size":2116,"noattachment":false,"key":"/multibuffer-stream/-/multibuffer-stream-2.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/multibuffer-stream/download/multibuffer-stream-2.0.1.tgz"},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"publish_time":1386962066210,"_hasShrinkwrap":false,"_cnpm_publish_time":1386962066210,"_cnpmcore_publish_time":"2021-12-16T22:24:27.834Z"},"2.0.0":{"name":"multibuffer-stream","version":"2.0.0","description":"A streaming interface for multibuffer.","main":"index.js","directories":{"test":"test"},"dependencies":{"multibuffer":"~2.0.0","through2":"~0.2.3","through2-map":"~1.2.0","bops":"~0.1.0"},"devDependencies":{"tape":"~1.1.1","stream-spigot":"~2.1.2","terminus":"~1.0.2"},"scripts":{"test":"node test/"},"keywords":["buffers","encoding","transport","stream"],"author":{"name":"Bryce B. Baril"},"license":"MIT","repository":{"type":"git","url":"git://github.com/brycebaril/multibuffer-stream.git"},"bugs":{"url":"https://github.com/brycebaril/multibuffer-stream/issues"},"readmeFilename":"README.md","_id":"multibuffer-stream@2.0.0","dist":{"shasum":"98c2e36a29776f83a29cad99ffbc72be6f18ff71","size":2119,"noattachment":false,"key":"/multibuffer-stream/-/multibuffer-stream-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/multibuffer-stream/download/multibuffer-stream-2.0.0.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"publish_time":1381447673039,"_hasShrinkwrap":false,"_cnpm_publish_time":1381447673039,"_cnpmcore_publish_time":"2021-12-16T22:24:28.043Z"},"1.0.1":{"name":"multibuffer-stream","version":"1.0.1","description":"A streaming interface for multibuffer.","main":"index.js","directories":{"test":"test"},"dependencies":{"multibuffer":"~1.3.1","through2":"~0.2.3","through2-map":"~1.2.0","bops":"~0.1.0"},"devDependencies":{"tape":"~1.1.1","stream-spigot":"~2.1.2","terminus":"~1.0.2"},"scripts":{"test":"node test/"},"keywords":["buffers","encoding","transport","stream"],"author":{"name":"Bryce B. Baril"},"license":"MIT","repository":{"type":"git","url":"git://github.com/brycebaril/multibuffer-stream.git"},"bugs":{"url":"https://github.com/brycebaril/multibuffer-stream/issues"},"readmeFilename":"README.md","_id":"multibuffer-stream@1.0.1","dist":{"shasum":"9fc403b059b82d2ade641d2d52cb36a1129df6f4","size":2123,"noattachment":false,"key":"/multibuffer-stream/-/multibuffer-stream-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/multibuffer-stream/download/multibuffer-stream-1.0.1.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"publish_time":1380921281680,"_hasShrinkwrap":false,"_cnpm_publish_time":1380921281680,"_cnpmcore_publish_time":"2021-12-16T22:24:28.283Z"},"1.0.0":{"name":"multibuffer-stream","version":"1.0.0","description":"A streaming interface for multibuffer.","main":"index.js","directories":{"test":"test"},"dependencies":{"multibuffer":"~1.2.2","through2":"~0.2.3","through2-map":"~1.2.0","bops":"~0.1.0"},"devDependencies":{"tape":"~1.1.1","stream-spigot":"~2.1.2","terminus":"~1.0.2"},"scripts":{"test":"node test/"},"keywords":["buffers","encoding","transport","stream"],"author":{"name":"Bryce B. Baril"},"license":"MIT","repository":{"type":"git","url":"git://github.com/brycebaril/multibuffer-stream.git"},"bugs":{"url":"https://github.com/brycebaril/multibuffer-stream/issues"},"readmeFilename":"README.md","_id":"multibuffer-stream@1.0.0","dist":{"shasum":"ee347a2f20e37f85529d4c45ba599f5c8a6d87e7","size":2163,"noattachment":false,"key":"/multibuffer-stream/-/multibuffer-stream-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/multibuffer-stream/download/multibuffer-stream-1.0.0.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":""}],"publish_time":1380608233982,"_hasShrinkwrap":false,"_cnpm_publish_time":1380608233982,"_cnpmcore_publish_time":"2021-12-16T22:24:28.469Z"}},"readme":"multibuffer-stream\n=====\n\n[![NPM](https://nodei.co/npm/multibuffer-stream.svg)](https://nodei.co/npm/multibuffer-stream/)\n\nA streaming version of [multibuffer](http://npm.im/multibuffer)\n\nThis is useful for packaging your buffers to cross transport layers that may alter the stream frame boundaries (e.g. combine chunks or break in the middle of them) so they can be re-assembled into the original buffers.\n\n```javascript\nvar mbstream = require(\"multibuffer-stream\")\nvar through2 = require(\"through2\")\nvar spigot = require(\"stream-spigot\")\n\nspigot([\"my\", \"dear\", \"aunt\", \"sally\"])\n  .pipe(mbstream.packStream()) // encode\n  .pipe(through2(function (chunk, encoding, callback) {\n    // Brutally chunk the stream into <= 3 byte chunks\n    var len = chunk.length\n    for (var i = 0; i < len; i += 3) {\n      this.push(chunk.slice(i, i + 3))\n    }\n    callback()\n  }))\n  .pipe(mbstream.unpackStream()) // re-assemble into original buffers\n  .pipe(through2(function (chunk, encoding, callback) {\n    chunk[0] = chunk[0] - 32 // upper-case first character\n    this.push(chunk)\n    return callback()\n  }))\n  .pipe(process.stdout)\n\n/*\nMyDearAuntSally\n */\n\n// Convert a stream into a multibuffer stream with `wrap`\n// **NOTE** You **MUST** know the full length of the stream first!\nvar fs = require(\"fs\")\nvar file = \"./README.md\"\nvar size = fs.statSync(file).size\nfs.createReadStream(file)\n  .pipe(mbstream.wrap(size))     // convert to multibuffer-stream\n  .pipe(mbstream.unpackStream()) // convert back to regular stream\n\n```\n\nAPI\n===\n\n`.packStream()`\n---\n\nCreate a `stream.Transform` instance that will convert buffers written to it into [multibuffers](http://npm.im/multibuffer)\n\n`.unpackStream()`\n---\n\nCreate a `stream.Transform` instance that will re-assemble the original packed stream.\n\n`.wrap(byteLength)`\n---\n\nCreates a `Transform` stream that will wrap a **known length** stream as a multibuffer (i.e. prefix the first chunk with the length).\n\nThis means it is not suitable for never-ending streams.\n\nLICENSE\n=======\n\nMIT\n","_attachments":{},"homepage":"https://github.com/brycebaril/multibuffer-stream","bugs":{"url":"https://github.com/brycebaril/multibuffer-stream/issues"},"license":"MIT"}