{"_id":"slice-stream","_rev":"62604","name":"slice-stream","description":"Pipe data through a stream until some fixed length is reached, then callback.","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"evanoxfeld","email":"eoxfeld@gmail.com"}],"time":{"modified":"2021-06-03T10:21:12.000Z","created":"2013-03-15T06:31:17.030Z","1.0.0":"2014-09-09T01:35:32.746Z","0.0.0":"2013-03-15T06:31:17.030Z"},"users":{},"author":{"name":"Evan Oxfeld","email":"eoxfeld@gmail.com"},"repository":{"type":"git","url":"https://github.com/EvanOxfeld/slice-stream.git"},"versions":{"1.0.0":{"name":"slice-stream","version":"1.0.0","description":"Pipe data through a stream until some fixed length is reached, then callback.","main":"slicestream.js","directories":{"example":"examples","test":"test"},"scripts":{"test":"tap ./test/*.js"},"repository":{"type":"git","url":"https://github.com/EvanOxfeld/slice-stream.git"},"keywords":["slice","fixed","length","stream","split"],"author":{"name":"Evan Oxfeld","email":"eoxfeld@gmail.com"},"license":"MIT","gitHead":"9054cbab67c2e71ab9241dbe88401c786b270f8e","dependencies":{"readable-stream":"~1.0.31"},"devDependencies":{"stream-buffers":">= 0.2.4 < 1","tap":">= 0.4.0 < 1"},"bugs":{"url":"https://github.com/EvanOxfeld/slice-stream/issues"},"homepage":"https://github.com/EvanOxfeld/slice-stream","_id":"slice-stream@1.0.0","_shasum":"5b33bd66f013b1a7f86460b03d463dec39ad3ea0","_from":".","_npmVersion":"1.4.21","_npmUser":{"name":"evanoxfeld","email":"eoxfeld@gmail.com"},"maintainers":[{"name":"evanoxfeld","email":"eoxfeld@gmail.com"}],"dist":{"shasum":"5b33bd66f013b1a7f86460b03d463dec39ad3ea0","size":2307,"noattachment":false,"key":"/slice-stream/-/slice-stream-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/slice-stream/download/slice-stream-1.0.0.tgz"},"publish_time":1410226532746,"_cnpm_publish_time":1410226532746,"_hasShrinkwrap":false},"0.0.0":{"name":"slice-stream","version":"0.0.0","description":"Pipe data through a stream until some fixed length is reached, then callback.","main":"slicestream.js","directories":{"example":"examples","test":"test"},"scripts":{"test":"./node_modules/.bin/tap ./test/*.js"},"repository":{"type":"git","url":"https://github.com/EvanOxfeld/slice-stream.git"},"keywords":["slice","fixed","length","stream","split"],"author":{"name":"Evan Oxfeld","email":"eoxfeld@gmail.com"},"license":"MIT","readmeFilename":"README.md","gitHead":"9054cbab67c2e71ab9241dbe88401c786b270f8e","dependencies":{"readable-stream":"~1.0.2"},"devDependencies":{"stream-buffers":"~0.2.4","tap":"~0.4.0"},"_id":"slice-stream@0.0.0","dist":{"shasum":"8183df87ad44ae0b48c0625134eac6e349747860","size":6550,"noattachment":false,"key":"/slice-stream/-/slice-stream-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/slice-stream/download/slice-stream-0.0.0.tgz"},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"evanoxfeld","email":"eoxfeld@gmail.com"},"maintainers":[{"name":"evanoxfeld","email":"eoxfeld@gmail.com"}],"publish_time":1363329077030,"_hasShrinkwrap":false,"_cnpm_publish_time":1363329077030}},"readme":"slice-stream [![Build Status](https://travis-ci.org/EvanOxfeld/slice-stream.png)](https://travis-ci.org/EvanOxfeld/slice-stream)\n============\n\nPipe data through a stream until some fixed length is reached, then callback.\n\n## Installation\n\n```bash\n$ npm install slice-stream\n```\n\n## Quick Example\n\n### End stream once a fixed length has been reached\n\n```javascript\nvar SliceStream = require('../');\nvar streamBuffers = require(\"stream-buffers\");\n\nvar ss = new SliceStream({ length: 5}, function (buf, sliceEnd, extra) {\n  if (!sliceEnd) {\n    return this.push(buf);\n  }\n  this.push(buf);\n  return this.push(null); //signal end of data\n});\n\nvar sourceStream = new streamBuffers.ReadableStreamBuffer();\nsourceStream.put(\"Hello World\");\nvar writableStream = new streamBuffers.WritableStreamBuffer();\n\nsourceStream\n  .pipe(ss)\n  .pipe(writableStream)\n  .once('close', function () {\n    var str = writableStream.getContentsAsString('utf8');\n    console.log('First 5 bytes piped:', \"'\" + str + \"'\");\n    sourceStream.destroy();\n  });\n\n//Output\n//Piped data before pattern occurs: 'Hello'\n```\n\n## License\n\nMIT","_attachments":{},"homepage":"https://github.com/EvanOxfeld/slice-stream","bugs":{"url":"https://github.com/EvanOxfeld/slice-stream/issues"},"license":"MIT"}