Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

std/encoding/ascii85.ts

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
import * as mod from "https://deno.land/std@0.168.0/encoding/ascii85.ts";

encode and decode for Ascii85/base85 encoding.

This module is browser compatible.

Specifying a standard and delimiter

By default, all functions are using the most popular Adobe version of ascii85 and not adding any delimiter. However, there are three more standards supported - btoa (different delimiter and additional compression of 4 bytes equal to 32), Z85 and RFC 1924. It's possible to use a different encoding by specifying it in options object as a second parameter.

Similarly, it's possible to make encode add a delimiter (<~ and ~> for Adobe, xbtoa Begin and xbtoa End with newlines between the delimiters and encoded data for btoa. Checksums for btoa are not supported. Delimiters are not supported by other encodings.)

Examples

Example 1

import {
  decode,
  encode,
} from "https://deno.land/std@0.168.0/encoding/ascii85.ts";

const a85Repr = "LpTqp";

const binaryData = decode(a85Repr);
console.log(binaryData);
// => Uint8Array [ 136, 180, 79, 24 ]

console.log(encode(binaryData));
// => LpTqp

Functions

Decodes a given ascii85 encoded string.

Encodes a given Uint8Array into ascii85, supports multiple standards

Interfaces

encoding/decoding options