btoa for Node.JS (it's a one-liner)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
AJ ONeal 19e0da6568 v1.2.1 6 years ago
bin v1.2.0 6 years ago
.gitignore Initial commit 11 years ago
LICENSE Initial commit 11 years ago
LICENSE.DOCS satisfying the money-hungry lawyers... 10 years ago
README.md v1.2.0 6 years ago
index.js v1.2.0 6 years ago
package.json v1.2.1 6 years ago
test.js handle actual binary, not just utf8 12 years ago

README.md

btoa

| atob | btoa | unibabel.js | Sponsored by ppl

A port of the browser's btoa function.

Uses Buffer to emulate the exact functionality of the browser's btoa (except that it supports some unicode that the browser may not).

It turns binary data to base64-encoded ascii.

(function () {
  "use strict";

  var btoa = require('btoa');
  var bin = "Hello, 世界";
  var b64 = btoa(bin);

  console.log(b64); // "SGVsbG8sIBZM"
}());

Note: Unicode may or may not be handled incorrectly. This module is intended to provide exact compatibility with the browser.

Copyright and License

Code copyright 2012-2018 AJ ONeal

Dual-licensed MIT and Apache-2.0

Docs copyright 2012-2018 AJ ONeal

Docs released under Creative Commons.