{"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":"0.1.0","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.1.0","dist":{"shasum":"693db93b36a87b44ba0f113c13a03b369fba3d7e","tarball":"http://registry-npm.ywwl.com/base64-stream/download/base64-stream-0.1.0.tgz","integrity":"sha512-ob4dYAcMcmQG/8NSznxiONFb62QmbTnwUhf2+wRri4ShKqS97YeMM3n/YRvq8ImzvazR0fHfpWThT6DISAZQxA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHx6KGDo8DAvXHpsr5QWeuLHmQbUKVxvrigmrvfCvePmAiAD0JLqKmBRFiGNp1pjYvZffYSPOSISQL2DzrGrSBWNeQ=="}],"size":2886,"noattachment":false,"key":"/base64-stream/-/base64-stream-0.1.0.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":1373343803088,"_cnpm_publish_time":1373343803088,"dist-tags":{"latest":"1.0.0"}}