{"name":"base64-stream","description":"Contains new Node v0.10 style stream classes for encoding / decoding Base64 data","keywords":["Base64","stream","streaming","piping"],"author":{"name":"Ross Johnson","email":"ross@mazira.com"},"version":"0.0.1","repository":{"type":"git","url":"http://github.com/mazira/base64-stream"},"scripts":{"test":"mocha --reporter spec"},"dependencies":{},"devDependencies":{"mocha":"*","should":"*"},"license":"MIT","engine":"node >= 10.0","bugs":{"url":"https://github.com/mazira/base64-stream/issues"},"_id":"base64-stream@0.0.1","dist":{"shasum":"9289593a8bd5b11a7eb6f1fb7b086150aa80ad5d","tarball":"http://registry-npm.ywwl.com/base64-stream/download/base64-stream-0.0.1.tgz","integrity":"sha512-JV/R85xo8J41s13YfL+JHH6UCp+DnFDcO+uiZLd4d15QvompdAtynNp6aU8pT3ddXOMpz27D6ir+wEZDkFoHDg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDKDdWszhePjOHtS+y26/8K6akIqf0jmrU5MMD8FkfRbQIgA/5l+fiRDKq0VwCLG5KqtYyu6uW0VEoE5vn3KDCutuA="}],"size":2389,"noattachment":false,"key":"/base64-stream/-/base64-stream-0.0.1.tgz"},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"rossj","email":"ross@mazira.com"},"maintainers":[{"name":"rossj","email":"ross@mazira.com"}],"directories":{},"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":1373335858040,"_cnpm_publish_time":1373335858040,"dist-tags":{"latest":"1.0.0"}}