@lapo/z85

1.0.0 • Public • Published

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' });

Package Sidebar

Install

npm i @lapo/z85

Weekly Downloads

8

Version

1.0.0

License

Apache-2.0

Unpacked Size

19.4 kB

Total Files

4

Last publish

Collaborators

  • lapo