https://github.com/paulopacitti/super-base-64
:stars: Simple one-function-library to encode a Blob image in base64
https://github.com/paulopacitti/super-base-64
base64 base64-encoding browser typescript
Last synced: 11 months ago
JSON representation
:stars: Simple one-function-library to encode a Blob image in base64
- Host: GitHub
- URL: https://github.com/paulopacitti/super-base-64
- Owner: paulopacitti
- License: mit
- Created: 2020-02-27T13:37:34.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-12T15:08:33.000Z (almost 6 years ago)
- Last Synced: 2025-02-18T12:07:31.741Z (12 months ago)
- Topics: base64, base64-encoding, browser, typescript
- Language: TypeScript
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# super-base-64

- Simple *one-function-library* to encode a **Blob image** in `base64`;
- **Promise based** (just use `async/await` to use sync, don't panic);
- Works with the **Browser API**;
### Install
```bash
npm install super-base-64
```
### Usage
- *Async/Await* style:
```javascript
import superBase64 from 'super-base-64';
mammaMia = async (file) => {
let itsAMeMario = await superBase64(file);
console.log(itsAMeMario); // logs the image file encoded in base64
}
```
- Promise style:
```javascript
import superBase64 from 'super-base-64';
mammaMia = (file) => {
superBase64(file).then((encoded) => console.log(encoded)); // logs the image file encoded in base64
}
```