No description
  • JavaScript 86.9%
  • HTML 13.1%
Find a file
2017-02-28 12:23:59 +01:00
old mv base64-1.7.js old/ 2013-04-06 15:41:58 +00:00
test Mocha 3 compatibility 2016-09-12 13:37:12 +09:00
.gitignore + README.md and tests/*.js 2012-08-23 09:48:48 +00:00
.travis.yml simplify .travis.yml 2015-11-03 02:02:31 +09:00
base64.html now base64.js is regexp-based 2009-03-01 22:07:11 +00:00
base64.js Update bower/base64 to match LICENSE. 2015-09-02 10:05:12 +10:00
base64.min.js VERSION 2.1.9 2015-07-31 11:11:34 +09:00
base64_utf8 Create base64_utf8 2013-12-11 16:28:26 +08:00
bower.json fixes license name for bower and npm (BSD -> BSD 3-Clause) 2016-10-26 22:50:19 +02:00
composer.json added composer.json 2017-02-28 12:23:59 +01:00
LICENSE.md Create LICENSE.md 2014-12-06 15:47:23 -05:00
package.js * add support for meteor.js 2014-04-01 15:28:34 +04:00
package.json fixes license name for bower and npm (BSD -> BSD 3-Clause) 2016-10-26 22:50:19 +02:00
README.md Update TypeScript 2.0 install to README 2016-09-26 07:56:35 -04:00

build status

base64.js

Yet another Base64 transcoder

Usage

In Browser

<script src="base64.js"></script>

node.js

var Base64 = require('js-base64').Base64;

npm

$ npm install --save js-base64

SYNOPSIS

Base64.encode('dankogai');  // ZGFua29nYWk=
Base64.encode('小飼弾');    // 5bCP6aO85by+
Base64.encodeURI('小飼弾'); // 5bCP6aO85by-

Base64.decode('ZGFua29nYWk=');  // dankogai
Base64.decode('5bCP6aO85by+');  // 小飼弾
// note .decodeURI() is unnecessary since it accepts both flavors
Base64.decode('5bCP6aO85by-');  // 小飼弾

String Extension for ES5

if (Base64.extendString) {
    // you have to explicitly extend String.prototype
    Base64.extendString();
    // once extended, you can do the following
    'dankogai'.toBase64();       // ZGFua29nYWk=
    '小飼弾'.toBase64();         // 5bCP6aO85by+
    '小飼弾'.toBase64(true);     // 5bCP6aO85by-
    '小飼弾'.toBase64URI();      // 5bCP6aO85by-
    'ZGFua29nYWk='.fromBase64(); // dankogai
    '5bCP6aO85by+'.fromBase64(); // 小飼弾
    '5bCP6aO85by-'.fromBase64(); // 小飼弾
}

TypeScript

TypeScript 2.0 type definition was added to the DefinitelyTyped repository.

$ npm install --save @types/js-base64

SEE ALSO