-
Book Overview & Buying
-
Table Of Contents
Coffeescript Application Development Cookbook
By :
Base64 encoding allows us to transform binary data into text data. The reasons for this are rooted in the history of network protocols, but it is still a widely used form of encoding when shipping binary data.
For example, binary e-mail attachments are first converted to base64 before being sent. It happens to be a handy way to include images within the context of an e-mail body.
In these recipes, we will see how to encode and decode binary and base64-encoded files.
Node provides a string Buffer class that can represent text data in a variety of encodings, including ASCII, UTF-8, and Base-64. This Buffer class will be the core of our conversion operations.
Node supports base64 encoding without the need of an external module. We will be using Node's built-in capabilities.
We will create a Node module that exposes a method to convert ASCII toBase64() and another Node to convert to ASCII fromBase64():
Create a function...
Change the font size
Change margin width
Change background colour