{"_id":"buffer-concat","_rev":"6045","name":"buffer-concat","description":"concat patch for Buffer in node < 0.8.","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"time":{"modified":"2021-06-03T09:56:49.000Z","created":"2012-10-11T12:52:09.010Z","1.0.0":"2016-08-02T23:34:51.083Z","0.0.1":"2012-10-11T12:52:09.010Z"},"users":{},"author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"repository":{"type":"git","url":"git://github.com/fengmk2/buffer-concat.git"},"versions":{"1.0.0":{"name":"buffer-concat","version":"1.0.0","description":"concat patch for Buffer in node < 0.8.","main":"index.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/fengmk2/buffer-concat.git"},"keywords":["concat","buffer.concat","buffer"],"devDependencies":{"should":"*","jscover":"*","mocha":"*"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"license":"MIT","gitHead":"14d604947e38aa5dbc80436c17fddc5ce266ef0d","bugs":{"url":"https://github.com/fengmk2/buffer-concat/issues"},"homepage":"https://github.com/fengmk2/buffer-concat#readme","_id":"buffer-concat@1.0.0","_shasum":"2defadadcb145e0ad3c0b961cde1910b118d1fe6","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.1","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"dist":{"shasum":"2defadadcb145e0ad3c0b961cde1910b118d1fe6","size":2464,"noattachment":false,"key":"/buffer-concat/-/buffer-concat-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/buffer-concat/download/buffer-concat-1.0.0.tgz"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/buffer-concat-1.0.0.tgz_1470180889001_0.9246419221162796"},"directories":{},"publish_time":1470180891083,"_cnpm_publish_time":1470180891083,"_hasShrinkwrap":false},"0.0.1":{"name":"buffer-concat","version":"0.0.1","description":"concat patch for Buffer in node < 0.8.","main":"index.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/fengmk2/buffer-concat.git"},"keywords":["concat","buffer.concat","buffer"],"devDependencies":{"should":"*","mocha":"*"},"author":{"name":"fengmk2","email":"fengmk2@gmail.com","url":"http://fengmk2.github.com"},"license":"MIT","_id":"buffer-concat@0.0.1","dist":{"shasum":"43e1e3c77f3d22fb55bea6890a92d03778c4c10a","size":2021,"noattachment":false,"key":"/buffer-concat/-/buffer-concat-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/buffer-concat/download/buffer-concat-0.0.1.tgz"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"directories":{},"publish_time":1349959929010,"_hasShrinkwrap":false,"_cnpm_publish_time":1349959929010}},"readme":"buffer-concat [![Build Status](https://secure.travis-ci.org/fengmk2/buffer-concat.png)](http://travis-ci.org/fengmk2/buffer-concat)\n=============\n\n![logo](https://raw.github.com/fengmk2/buffer-concat/master/logo.png)\n\nconcat patch for Buffer in node &lt; 0.8.\n\n* jscoverage: [100%](http://fengmk2.github.com/coverage/buffer-concat.html)\n\n## Install\n\n```bash\n$ npm install buffer-concat\n```\n\n## Usage\n\n```js\n// require before you use Buffer.concat\nvar bufferConcat = require('buffer-concat');\n\nvar b1 = new Buffer('Hello');\nvar b2 = new Buffer(' world');\nvar b3 = bufferConcat([b1, b2]);\nconsole.log(b3.toString());\n\n// for datas concat\nvar http = require('http');\nvar options = {\n  host: 'nodejs.org'\n};\nhttp.get(options, function (res) {\n  var chunks = [];\n  var size = 0;\n  res.on('data', function (chunk) {\n    size += chunk.length;\n    chunks.push(chunk);\n  });\n  res.on('end', function () {\n    var data = bufferConcat(chunks, size);\n    console.log(data.toString());\n  });\n});\n```\n\nNode.js 0.8.0 and newer provides this functionality out of the box on the\nnative buffer object (`Buffer.concat`). If you rather this module work as a\n[polyfill](https://remysharp.com/2010/10/08/what-is-a-polyfill), you can require\nit as such: `require('buffer-concat/polyfill')`. Doing so will make sure that\n`Buffer.concat` works no matter what version of Node.js you are using.\n\n```javascript\nrequire('buffer-concat/polyfill');\n\nvar b1 = new Buffer('Hello');\nvar b2 = new Buffer(' world');\nvar b3 = Buffer.concat([b1, b2]);\nconsole.log(b3.toString());\n```\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2012 fengmk2 &lt;fengmk2@gmail.com&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_attachments":{},"homepage":"https://github.com/fengmk2/buffer-concat#readme","bugs":{"url":"https://github.com/fengmk2/buffer-concat/issues"},"license":"MIT"}