npm

Need private packages and team management tools?Check out npm Orgs. »

awesome-urlsafe-base64

1.1.2 • Public • Published

Build Status codecov

awesome-urlsafe-base64


This is a simple utility that will do base64 encoding and then do some replacing of the URL unfriendly characters that are potentially added during the base64 encoding.

This utility is somewhat compatible with the existing urlsafe-base64 NPM module.

Eventually this library will support Variants of the Base64 algorithm.

.encodeBuffer(buffer) :: string

Encodes a buffer as an URL Safe Base64-like string. This function encodes to the RFC 4648 Spec where '+' is encoded as '-' the '/' is encoded as '_' and the padding character '=' is encoded as '.'.

var AwesomeBase64 = require('awesome-urlsafe-base64');
var buffer = new Buffer('http://www.encode.me/please/kthxbye');
var encodedString = AwesomeBase64.encode(buffer);

.decodeBuffer(string) :: buffer

Decodes a previously encoded string.

var AwesomeBase64 = require('awesome-urlsafe-base64');
var toDecode = 'VWJlciBTdHJpbmcgdG8gRW5jb2Rl';
var buffer = AwesomeBase64.decode(toDecode);

.encodeString(string) :: string

Encodes a string.

var AwesomeBase64 = require('awesome-urlsafe-base64');
var toEncode = 'http://www.encode.me/please/kthxbye';
var encodedString = AwesomeBase64.encode(buffer);

.decodeString(string) :: string

Decodes a string.

var AwesomeBase64 = require('awesome-urlsafe-base64');
var toDecode = 'VWJlciBTdHJpbmcgdG8gRW5jb2Rl';
var decodedString = AwesomeBase64.encode(buffer);

.encode(buffer) :: string

Alias for .encodeBuffer

.decode(string) :: buffer

Alias for .decodeBuffer

install

npm i awesome-urlsafe-base64

Downloadsweekly downloads

14

version

1.1.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability