0.1.6 • Published 11 months ago

buffer-to-base64 v0.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

buffer-to-base64

build status Coverage Status

Social Media Photo by Belinda Fewings on Unsplash

A base64 encoder/decoder with gzip or deflate abilities.

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.

0.1.6

11 months ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.0

1 year ago