https://github.com/grjan7/base64
Library for Base64 encoding and decoding
https://github.com/grjan7/base64
base64 encoding javascript json nodejs
Last synced: 2 months ago
JSON representation
Library for Base64 encoding and decoding
- Host: GitHub
- URL: https://github.com/grjan7/base64
- Owner: grjan7
- License: gpl-3.0
- Created: 2022-08-27T16:08:56.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-08-27T16:16:59.000Z (almost 4 years ago)
- Last Synced: 2025-01-21T11:44:49.575Z (over 1 year ago)
- Topics: base64, encoding, javascript, json, nodejs
- Language: JavaScript
- Homepage:
- Size: 44.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# base64 library
## base64.encode(plainStr)
```js
import Base64 from 'base64';
const myObj = {name: "john", age: 30};
const myObjString = JSON.stringify(myObj);
const base64EncodedString = Base64.encode(myObjString);
console.log(base64EncodedString);
```
## base64.decode(base64Str)
```js
import Base64 from 'base64';
const myObj = {name: "john", age: 30};
const myObjString = JSON.stringify(myObj);
const base64EncodedString = Base64.encode(myObjString);
const decodedBase64String = Base64.decode(base64EncodedMyObj);
console.log(JSON.parse(decodedBase64String));
```