angular-utf8-base64
v0.0.5
Published
Base64 encoding/decoding with UTF8 support for AngularJS Apps, and including CommonJS module support.
Downloads
3,985
Maintainers
Readme
angular-utf8-base64
AngularJS service for UTF-8 and Base64 and Base64url Javascript Encoding.
CommonJS support wrapper for the version by Andrey Bezyazychniy. His implementation simply puts an AngularJS module wrapper around the Really fast Javascript Base64 encoder/decoder with utf-8 support, and this version wraps both to provide CommonJS support.
Installation
NPM
npm install angular-utf8-base64
<script src="angular-utf8-base64.js"></script>
Usage
angular
.module('someApp', ['utf8-base64'])
.controller('someController', [
'$scope', 'base64',
function ($scope, base64) {
$scope.encoded = base64.encode('a string');
$scope.decoded = base64.decode('YSBzdHJpbmc=');
}]);
Base64Url Support
Commonly used for supporting JWS and JWT encodings, base64url encoding creates a URL safe output.
angular
.module('someApp', ['utf8-base64'])
.controller('someController', [
'$scope', 'base64',
function ($scope, base64) {
$scope.encoded = base64.urlencode('a string');
$scope.decoded = base64.urldecode('YSBzdHJpbmc');
}]);