btoa.js/README.md

22 lines
496 B
Markdown
Raw Normal View History

2012-09-19 20:22:55 +00:00
btoa
===
2013-07-25 17:01:20 +00:00
A port of the browser's `btoa` function.
2012-09-19 20:22:55 +00:00
Uses `Buffer` to emulate the exact functionality of the browser's btoa (except that it supports unicode and the browser may not).
It turns **b**inary data **to** base64-encoded **a**scii.
(function () {
"use strict";
var btoa = require('btoa')
, bin = "Hello, 世界"
, b64 = btoa(bin)
;
console.log(b64); // "SGVsbG8sIBZM"
}());
Note: Unicode may or may not be handled incorrectly.