base64-stream
Advanced tools
+3
-3
| { | ||
| "name" : "base64-stream", | ||
| "description" : "Contains new Node v0.10 style stream classes for encoding / decoding Base64 data", | ||
| "keywords" : ["Base64", "stream", "streaming", "piping"], | ||
| "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" : "Ross Johnson <ross@mazira.com>", | ||
| "version" : "0.0.1", | ||
| "version" : "0.1.0", | ||
| "repository" : { | ||
@@ -8,0 +8,0 @@ "type" : "git", |
+45
-3
@@ -1,4 +0,46 @@ | ||
| base64-stream | ||
| ============= | ||
| # Introduction | ||
| Contains new Node v0.10 style stream classes for encoding / decoding Base64 data | ||
| While Node.js has built-in support for Base64 data, it does not come with the ability to encode / decode data in a stream. | ||
| This library contains a streaming Base64 encoder and a streaming Base64 decoder for use with Node.js. These streams are written using the new Node.js v0.10 [stream interfaces](http://nodejs.org/api/stream.html) and are well covered with unit tests. | ||
| # Installation | ||
| To install base64-stream | ||
| npm install base64-stream | ||
| # Requirements | ||
| This module currently requires Node v0.10. Support for Node v0.8 may be added in the future using the [readable-stream](https://github.com/isaacs/readable-stream) module. | ||
| # Usage | ||
| To use base64-stream | ||
| ```javascript | ||
| var fs = require('fs'); | ||
| var Base64Encode = require('base64-stream').Encode; | ||
| var Base64Decode = require('base64-stream').Decode; | ||
| var streamMailAttachment = function(req, res, next) { | ||
| var getAttachment(...); | ||
| attachmentStream.pipe(new Base64Encode()).pipe(res); | ||
| // would also work | ||
| // attachmentStream.pipe(Base64Encode()).pipe(res); | ||
| } | ||
| var uploadAttachment = function(req, res, next) { | ||
| var email = createEmail(...); | ||
| var stream = req.pipe(new Base64Encode()); | ||
| email.streamAttachment(stream); | ||
| } | ||
| ``` | ||
| # Testing | ||
| To run the unit tests | ||
| npm test |
10398
13.06%47
840%