Smart base64 encoder & decoder for Javascript
npm install xbase64Smart base64 encoder & decoder for Javascript
Node.js:
`` sh`
npm install xbase64
Bower:
` sh`
$ bower install xbase64
Browser:
``
Require it within your module:
` javascript``
var xbase64 = require('xbase64');
---
> byte buffer type defined.
>> NodeJS: Buffer, string (input only)
>> Browser: Number Array, string (input only)
Encodes byte buffer as a Base64 string.
> xbase64.encode("i'm xbase64");
>> output string: aSdtIHhiYXNlNjQ=
> xbase64.encode("i'm xbase64", true)
>> output string: aSdtIHhiYXNlNjQ
Decodes a Base64 string as a byte buffer.
> xbase64.decode("aSdtIHhiYXNlNjQ")
>> output to byte buffer: i'm xbase64
> xbase64.decode("aSdtIHhiYXNlNjQ=")
>> output to byte buffer: i'm xbase64
Decodes a Base64 string as a string.
> xbase64.decodeAsText("aSdtIHhiYXNlNjQ")
>> output to string: i'm xbase64
> xbase64.decodeAsText("aSdtIHhiYXNlNjQ=")
>> output to string: i'm xbase64
---
Encodes byte buffer as a URL Safe Base64 string.
Decodes a URL Safe Base64 string as a byte buffer.
Decodes a URL Safe Base64 string as a string.
---
Create a customize table XBase64 object.
#### XBase64.encode(buffer, [strip])
Encodes a buffer as a XBase64 string.
#### XBase64.decode(string)
Decodes a XBase64 string as a byte buffer.
#### XBase64.decodeAsText(string)
Decodes a XBase64 string as a string.
---
Generate new string from parameter string's random order.