Package Exports
- @coolgk/base64
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@coolgk/base64) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@coolgk/base64
a javascript / typescript module
npm install @coolgk/base64
base64 encoded decode functions
Report bugs here: https://github.com/coolgk/node-utils/issues
Examples
import { encode, decode, encodeUrl, decodeUrl } from '@coolgk/base64';
// OR
// const { encode, decode, encodeUrl, decodeUrl } = require('@coolgk/base64');
const a = 'https://www.google.co.uk/?a=b'
const hash = encode(a);
const urlHash = encodeUrl(a);
console.log(a); // https://www.google.co.uk/?a=b
console.log(hash); // aHR0cHM6Ly93d3cuZ29vZ2xlLmNvLnVrLz9hPWI=
console.log(decode(hash)); // https://www.google.co.uk/?a=b
console.log(urlHash); // aHR0cHM6Ly93d3cuZ29vZ2xlLmNvLnVrLz9hPWI
console.log(decodeUrl(urlHash)); // https://www.google.co.uk/?a=b
Functions
- encode(data) ⇒
string - decode(data) ⇒
string - encodeUrl(data) ⇒
string - decodeUrl(data) ⇒
string
encode(data) ⇒ string
Kind: global function
| Param | Type | Description |
|---|---|---|
| data | string |
string to encode |
decode(data) ⇒ string
Kind: global function
| Param | Type | Description |
|---|---|---|
| data | string |
encoded hash |
encodeUrl(data) ⇒ string
Kind: global function
| Param | Type | Description |
|---|---|---|
| data | string |
string to encode |
decodeUrl(data) ⇒ string
Kind: global function
| Param | Type | Description |
|---|---|---|
| data | string |
base64 encoded url to decode |