Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/webreflection/buffer-to-base64
A base64 encoder/decoder with gzip or deflate abilities.
https://github.com/webreflection/buffer-to-base64
base64 wasm web
Last synced: 22 days ago
JSON representation
A base64 encoder/decoder with gzip or deflate abilities.
- Host: GitHub
- URL: https://github.com/webreflection/buffer-to-base64
- Owner: WebReflection
- License: mit
- Created: 2024-06-10T09:30:10.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-10-30T13:11:29.000Z (3 months ago)
- Last Synced: 2024-12-31T15:13:51.459Z (28 days ago)
- Topics: base64, wasm, web
- Language: JavaScript
- Homepage: https://webreflection.medium.com/how-to-embed-your-wasm-blob-c29692119039
- Size: 65.4 KB
- Stars: 33
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# buffer-to-base64
[![build status](https://github.com/WebReflection/buffer-to-base64/actions/workflows/node.js.yml/badge.svg)](https://github.com/WebReflection/buffer-to-base64/actions) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/buffer-to-base64/badge.svg?branch=main)](https://coveralls.io/github/WebReflection/buffer-to-base64?branch=main)
**Social Media Photo by [Belinda Fewings](https://unsplash.com/@bel2000a) on [Unsplash](https://unsplash.com/)**
A base64 encoder/decoder with `gzip` or `deflate` abilities.
```js
import { encode, decode, stream } from 'buffer-to-base64';// return a base64 string after compression
const packed = await encode(buffer);// return an ArrayBuffer after decompression
const original = await decode(packed);// initialize a WebAssembly module streaming
const response = stream(packed, { type: 'application/wasm' });// eventually returns the ArrayBuffer too (fast decoding)
const arrayBuffer = await (await response).arrayBuffer();
// `arrayBuffer` is the same as `original`
```This module goal is to simplify the embedding of *WASM* or other blobs within code as `base64` that can return the original array without bloating space on the file.