@cdklabs/aws-data-solutions-framework
Version:
L3 CDK Constructs used to build data solutions with AWS
76 lines (50 loc) • 1.2 kB
Markdown

Simple Base is a simple library to encode or decode with base36/base58.
It is available both in Node and browsers.
```bash
yarn add simple-base
```
or
```bash
npm i simple-base
```
You also can link it by `script` tag in HTML. `SimpleBase` will be a global variable.
Use CommonJS:
```javascript
const SimpleBase = require('simple-base')
```
Use ES2015 Modules:
```javascript
import * as SimpleBase from 'simple-base'
```
Encoding:
```javascript
const encoded = SimpleBase.encode('hello', 36)
// or
const encoded = SimpleBase.base36.encode('hello')
```
Decoding:
```javascript
const decoded = SimpleBase.decode('5pzcszu7', 36)
// or
const decoded = SimpleBase.base36.decode('5pzcszu7')
```
Encoding:
```javascript
const encoded = SimpleBase.encode('hello', 58)
// or
const encoded = SimpleBase.base36.encode('hello')
```
Decoding:
```javascript
const decoded = SimpleBase.decode('Cn8eVZg', 58)
// or
const decoded = SimpleBase.base36.decode('Cn8eVZg')
```
MIT License © [Pig Fang](https://gplane.win/)