btoa
btoa for Node.JS (it's a one-liner)
Last updated 2 years ago by coolaj86 .
(MIT OR Apache-2.0) · Repository · Original npm · Tarball · package.json
$ cnpm install btoa 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 1.2.1                                ...           latest (2 years ago)

6 Versions

  • 1.2.1                                ...           2 years ago
  • 1.1.2                                ...           6 years ago
  • 1.1.1                                ...           7 years ago
  • 1.1.0                                ...           8 years ago
  • 1.0.1                                ...           8 years ago
  • 1.0.0                                ...           9 years ago
Maintainers (1)
Downloads
Today 199
This Week 3,623
This Month 12,454
Last Day 294
Last Week 3,256
Last Month 9,610
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (773)

Copyright 2014 - 2016 © taobao.org |