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 classes are written using the new Node.js v0.10 stream interfaces and are well covered with unit tests.
To install base64-stream
npm install base64-stream
This example encodes an image and pipes it to stdout.
var http = ;var base64 = ;var img = '';http;
This example takes in Base64 encoded data on stdin, decodes it, an pipes it to stdout.
var base64 = ;processstdin;
You may also treat
decode as classes, so the following is also valid:
var Base64Decode = decode;var stream = ;...
This module currently requires Node v0.8 or higher. Support for versions prior to v0.10 is made possible by using the readable-stream module.
To run the unit tests