{"_id":"block-stream2","_rev":"540","name":"block-stream2","description":"transform input into equally-sized blocks of output","dist-tags":{"latest":"2.1.0"},"maintainers":[{"name":"feross","email":""}],"time":{"modified":"2021-06-03T09:55:51.000Z","created":"2015-01-24T10:00:58.060Z","2.1.0":"2021-02-04T01:00:25.467Z","2.0.0":"2019-08-02T01:11:17.694Z","1.1.0":"2015-12-13T23:24:45.905Z","1.0.0":"2015-01-24T10:00:58.060Z"},"users":{"roccomuso":true},"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"repository":{"type":"git","url":"git://github.com/substack/block-stream2.git"},"versions":{"2.1.0":{"name":"block-stream2","version":"2.1.0","description":"transform input into equally-sized blocks of output","main":"index.js","dependencies":{"readable-stream":"^3.4.0"},"devDependencies":{"standard":"^16.0.3","tape":"^4.2.2"},"scripts":{"test":"standard && tape test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/block-stream2.git"},"homepage":"https://github.com/substack/block-stream2","keywords":["stream","block","chunk","size","streams2","streams3"],"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","gitHead":"a0292a5dab5690d2577d24087b3f13b1505042b6","bugs":{"url":"https://github.com/substack/block-stream2/issues"},"_id":"block-stream2@2.1.0","_nodeVersion":"14.15.4","_npmVersion":"6.14.10","dist":{"shasum":"ac0c5ef4298b3857796e05be8ebed72196fa054b","size":2456,"noattachment":false,"key":"/block-stream2/-/block-stream2-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/block-stream2/download/block-stream2-2.1.0.tgz"},"_npmUser":{"name":"feross","email":"feross@feross.org"},"directories":{},"maintainers":[{"name":"feross","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/block-stream2_2.1.0_1612400425358_0.5874287235233888"},"_hasShrinkwrap":false,"publish_time":1612400425467,"_cnpm_publish_time":1612400425467},"2.0.0":{"name":"block-stream2","version":"2.0.0","description":"transform input into equally-sized blocks of output","main":"index.js","dependencies":{"readable-stream":"^3.4.0"},"devDependencies":{"tape":"^4.2.2"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/block-stream2.git"},"homepage":"https://github.com/substack/block-stream2","keywords":["stream","block","chunk","size","streams2","streams3"],"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","gitHead":"e370801b89302000f88f48591729218655c2b535","bugs":{"url":"https://github.com/substack/block-stream2/issues"},"_id":"block-stream2@2.0.0","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"shasum":"680b9d357ca8b9d5637f4ec8a41fb5968029108f","size":2224,"noattachment":false,"key":"/block-stream2/-/block-stream2-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/block-stream2/download/block-stream2-2.0.0.tgz"},"maintainers":[{"name":"feross","email":""}],"_npmUser":{"name":"feross","email":"feross@feross.org"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/block-stream2_2.0.0_1564708277542_0.8416177987164468"},"_hasShrinkwrap":false,"publish_time":1564708277694,"_cnpm_publish_time":1564708277694},"1.1.0":{"name":"block-stream2","version":"1.1.0","description":"transform input into equally-sized blocks of output","main":"index.js","dependencies":{"defined":"^1.0.0","inherits":"^2.0.1","readable-stream":"^2.0.4"},"devDependencies":{"tape":"^4.2.2"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/block-stream2.git"},"homepage":"https://github.com/substack/block-stream2","keywords":["stream","block","chunk","size","streams2"],"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","gitHead":"2516d3952cf8aa991adc9e3e4dd5fc336e78368d","bugs":{"url":"https://github.com/substack/block-stream2/issues"},"_id":"block-stream2@1.1.0","_shasum":"c738e3a91ba977ebb5e1fef431e13ca11d8639e2","_from":".","_npmVersion":"3.4.1","_nodeVersion":"4.2.1","_npmUser":{"name":"substack","email":"substack@gmail.com"},"dist":{"shasum":"c738e3a91ba977ebb5e1fef431e13ca11d8639e2","size":3692,"noattachment":false,"key":"/block-stream2/-/block-stream2-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/block-stream2/download/block-stream2-1.1.0.tgz"},"maintainers":[{"name":"feross","email":""}],"directories":{},"publish_time":1450049085905,"_cnpm_publish_time":1450049085905,"_hasShrinkwrap":false},"1.0.0":{"name":"block-stream2","version":"1.0.0","description":"transform input into equally-sized blocks of output","main":"index.js","dependencies":{"defined":"~0.0.0","inherits":"^2.0.1","readable-stream":"^1.0.33"},"devDependencies":{"tape":"^3.0.3"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/substack/block-stream2.git"},"homepage":"https://github.com/substack/block-stream2","keywords":["stream","block","chunk","size","streams2"],"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT","gitHead":"16f711320cebafb4b0833de08b13139bab8f791b","bugs":{"url":"https://github.com/substack/block-stream2/issues"},"_id":"block-stream2@1.0.0","_shasum":"149f24a220b68838aa59222ec8b817ee62301c48","_from":".","_npmVersion":"2.1.16","_nodeVersion":"0.10.35","_npmUser":{"name":"substack","email":"mail@substack.net"},"maintainers":[{"name":"feross","email":""}],"dist":{"shasum":"149f24a220b68838aa59222ec8b817ee62301c48","size":3628,"noattachment":false,"key":"/block-stream2/-/block-stream2-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/block-stream2/download/block-stream2-1.0.0.tgz"},"directories":{},"publish_time":1422093658060,"_cnpm_publish_time":1422093658060,"_hasShrinkwrap":false}},"readme":"# block-stream2\n\ntransform input into equally-sized chunks as output\n\nstreams3 version of\n[block-stream](https://npmjs.org/package/block-stream)\n\n[![build status](https://secure.travis-ci.org/substack/block-stream2.png)](http://travis-ci.org/substack/block-stream2)\n\n# example\n\n``` js\nconst BlockStream = require('block-stream2');\nconst through = require('through2');\n\nprocess.stdin\n    .pipe(new BlockStream({ size: 16, zeroPadding: true }))\n    .pipe(through((buf, enc, next) => {\n        const str = buf.toString().replace(/[\\x00-\\x1f]/g, chr);\n        console.log(`buf[${buf.length}]=${str}`);\n        next();\n    }))\n;\nfunction chr (s) { return `\\\\x${pad(s.charCodeAt(0).toString(16),2)}` }\nfunction pad (s, n) { return Array(n - s.length + 1).join('0') + s }\n```\n\n```\n$ echo {c,d,f}{a,e,i,o,u}{t,g,r} | node example/stream.js\nbuf[16]=cat cag car cet\nbuf[16]=ceg cer cit cig\nbuf[16]=cir cot cog cor\nbuf[16]=cut cug cur dat\nbuf[16]=dag dar det deg\nbuf[16]=der dit dig dir\nbuf[16]=dot dog dor dut\nbuf[16]=dug dur fat fag\nbuf[16]=far fet feg fer\nbuf[16]=fit fig fir fot\nbuf[16]=fog for fut fug\nbuf[16]=fur\\x0a\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\n```\n\n# methods\n\n``` js\nconst BlockStream = require('block-stream2');\n```\n\n## const b = new BlockStream(opts)\n## const b = new BlockStream(size, opts)\n\nCreate a new transform stream `b` that outputs chunks of length `size` or\n`opts.size`.\n\nWhen `opts.zeroPadding` is false, do not zero-pad the last chunk.\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install block-stream2\n```\n\n# license\n\nMIT\n","_attachments":{},"homepage":"https://github.com/substack/block-stream2","bugs":{"url":"https://github.com/substack/block-stream2/issues"},"license":"MIT"}