1.0.0 • Published 3 years ago

@lapo/z85 v1.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

CometD-Z85

Z85 encoding/decoding implementation with automatic padding.

const Z85 = require('@lapo/z85');

// The source bytes (e.g. from an image).
const imageBytes = [0xC, 0x0, 0xF, 0xF, 0xE];

// Z85-encode the bytes into a string.
const string = Z85.encode(imageBytes);

// The encoded image bytes can be stored in a JSON field.
const json = {
  image: string
};


// A Z85-encoded image in a JSON field.
const string = json.image;

// Z85-decode into bytes.
const buffer = Z85.decode(string);

// Use the bytes in a Blob.
const blob = new Blob([buffer], { type: 'image/png' });