{"name":"base64-stream","description":"Contains new Node.js v0.10 style stream classes for encoding / decoding Base64 data","keywords":["Base64","stream","streaming","piping","node","node.js","encode","decode"],"author":{"name":"Ross Johnson","email":"ross@mazira.com"},"version":"1.0.0","repository":{"type":"git","url":"git+ssh://git@github.com/mazira/base64-stream.git"},"scripts":{"test":"mocha --reporter spec"},"dependencies":{},"devDependencies":{"mocha":"*","should":"*"},"license":"MIT","engine":"node >= 0.8.0","gitHead":"994b84d7a022faaad590c8e79966bfada3efff24","bugs":{"url":"https://github.com/mazira/base64-stream/issues"},"homepage":"https://github.com/mazira/base64-stream#readme","_id":"base64-stream@1.0.0","_npmVersion":"5.5.1","_nodeVersion":"8.9.0","_npmUser":{"name":"rossj","email":"ross@mazira.com"},"dist":{"integrity":"sha512-BQQZftaO48FcE1Kof9CmXMFaAdqkcNorgc8CxesZv9nMbbTF1EFyQe89UOuh//QMmdtfUDXyO8rgUalemL5ODA==","shasum":"157ae00bc7888695e884e1fcc51c551fdfa8a1fa","tarball":"http://registry-npm.ywwl.com/base64-stream/download/base64-stream-1.0.0.tgz","fileCount":5,"unpackedSize":7758,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbw1LiCRA9TVsSAnZWagAAO+0P/AkeVc5xQ6wnVlKCHVAp\nyxVpdkR8avwQ16eh0FRtl5UiF0DleLFecLibBXpoGWdAvvESfyI1pwmwXUgJ\nwokjHPr61cFpO9m+9cbhiTdduOJEylQ4pyOmY5mFUy+dkA9CriHVz0VU1cW9\nrsxTgqGIaELG8jePNE2ImwW90In6oH6pDeG+T6W8KN3Mo2QasxC1kNkPboVG\n6PHGjjSWmu0BPhTa35QoFmwaf+jJN4zLXHCwgJ9td6HUIVTp4Prc3Yhl24Yb\n8GANblLGHSG9qf0cDiCs0yHb3IhPqxmT7jEVNk3Mr75cvIkJruJNastQ7E00\nHfCbdfinGcsXfV/uF7oMHSzLUZv3hcnI4yfnfX1wCYU58HW4BvJ312AaJFIg\n4i2QXPQcKHU93vYh62Tn6Pg0u5H/WmsWa38daxTWUPQwCcGliBEFi9x2ecSS\nq3G2lEOawXXBhsYRtBv2ieYSFuoLs7w2GkJT+emwSAg0GAHIetInjtz8luC5\ndgvRNuDoLmUQWXfnMTI2O1/g/MWt1Hl7RMvKVf9JTFU/9qqOA0/frrIJV+//\n6XJKRdF4ZQWu0AWGmNGotX1XMZ8jXRs9G1hoxybD1DHC5P+d/ZBmn9V0aDTR\niy2vs3EnzX3chSxbMC1v4+C6vV2QK9Jt/Geq7WRHAuAt9c5tDxWtF/f5MmWc\nRWFn\r\n=Z9eM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHzuy/FtcxnRb+xAbP+Pe6ViP9aCYE75oRemPn2CnSMZAiEAs7CMQy5tDA/fTXFafn5JN/5xZQPjJkRc6pDMYMpnDlg="}],"size":2845,"noattachment":false,"key":"/base64-stream/-/base64-stream-1.0.0.tgz"},"maintainers":[{"name":"rossj","email":"ross@mazira.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/base64-stream_1.0.0_1539527393753_0.48322501618036373"},"_hasShrinkwrap":false,"readme":"# Introduction\n\nWhile Node.js has built-in support for Base64 data, it does not come with the ability to encode / decode data in a stream.\n\nThis library contains a streaming Base64 encoder and a streaming Base64 decoder for use with Node.js. These classes are written using the Node.js [stream interfaces](http://nodejs.org/api/stream.html) and are well covered with unit tests.\n\n# Usage\n\n## Installation\n\nTo install base64-stream\n\n    npm install base64-stream\n    \n## Examples\nThis example encodes an image and pipes it to stdout.\n\n```javascript\nvar http = require('http');\nvar {Base64Encode} = require('base64-stream');\n\nvar img = 'http://farm3.staticflickr.com/2433/3973241798_86ddfa642b_o.jpg';\nhttp.get(img, function(res) {\n    if (res.statusCode === 200)\n        res.pipe(new Base64Encode()).pipe(process.stdout);\n});\n```\n\nThis example takes in Base64 encoded data on stdin, decodes it, an pipes it to stdout.\n```javascript\nvar {Base64Encode} = require('base64-stream');\nprocess.stdin.pipe(new Base64Encode()).pipe(process.stdout);\n```\n\n## options:\n\n`Base64Encode` can take an optional object `{lineLength: number, prefix: string}`  \nThe prefix is useful for prepending for example `data:image/png;base64,` to make a base64 URL.  \nThis example proxies an image url, and send the base64 string in response.\n\n```\napp.get('/i/*', function(req, res){ // using express for example\n\tfetch(req.params[0]) // using node-fetch\n\t.then(r=>r.body.pipe(new Base64Encode({prefix:`data:${r.headers.get('content-type')};base64,`})).pipe(res))\n\t.catch(console.error);\n});\n```\n\n# Requirements\n\nThis module currently requires Node 6.0.0 or higher.\n\n# Testing\n\nTo run the unit tests\n\n    npm test\n\n# License\nMIT\n","publish_time":1539527393843,"_cnpm_publish_time":1539527393843,"dist-tags":{"latest":"1.0.0"}}