Utilities for encoding and decoding common formats like hex, base64, and varint
ascii85
encode and decode for
Ascii85/base85 encoding.
encode and decode for
Ascii85/base85 encoding.
Decodes a given ascii85 encoded string.
Encodes a given Uint8Array into ascii85, supports multiple standards
Returns number of bytes encoded in the given RFC4648 base32 string input.
Decodes a given RFC4648 base32 encoded string.
Encodes a given Uint8Array into RFC4648 base32 representation
Decodes a given b58 string according to draft-mspotny-base58-03 RFC base58 representation: https://tools.ietf.org/id/draft-msporny-base58-01.html#rfc.section.1
Encodes a given Uint8Array, ArrayBuffer or string into draft-mspotny-base58-03 RFC base58 representation: https://tools.ietf.org/id/draft-msporny-base58-01.html#rfc.section.1
Decodes a given RFC4648 base64 encoded string
CREDIT: https://gist.github.com/enepomnyaschih/72c423f727d395eeaa09697058238727 Encodes a given Uint8Array, ArrayBuffer or string into RFC4648 base64 representation
base64url
encode and decode for
base64 URL safe encoding.
binary
Functions for encoding binary data in array buffers.
How encoded binary data is ordered.
Reads exactly n bytes from r.
Encodes bigint x into b. Returns the number of bytes used, or 0 if b is shorter than sizeof(o.dataType).
Encodes number x into b. Returns the number of bytes used, or 0 if b is shorter than sizeof(o.dataType).
Reads the exact number of bytes from r required to fill b.
Decodes a bigint from r, consuming sizeof(o.dataType) bytes. If less than sizeof(o.dataType) bytes were read, throws Deno.errors.unexpectedEof.
Decodes a number from r, consuming sizeof(o.dataType) bytes. If less than sizeof(o.dataType) bytes were read, throws Deno.errors.unexpectedEof.
Number of bytes required to store dataType.
Decodes a bigint from b. If o.bytes is shorter than sizeof(o.dataType), returns null.
Encodes x into a new Uint8Array.
Decodes a number from b. If o.bytes is shorter than sizeof(o.dataType), returns null.
Encodes x into a new Uint8Array.
Encodes and writes x to w. Resolves to the number of bytes written.
Encodes and writes x to w. Resolves to the number of bytes written.
hex
Port of the Go encoding/hex library.
varint
Functions for encoding typed integers in array buffers.
Given a buf, starting at offset (default: 0), begin decoding bytes as
VarInt encoded bytes, for a maximum of 10 bytes (offset + 10). The returned
tuple is of the decoded varint 32-bit number, and the new offset with which
to continue decoding other data.
Given a buf, starting at offset (default: 0), begin decoding bytes as
VarInt encoded bytes, for a maximum of 5 bytes (offset + 5). The returned
tuple is of the decoded varint 32-bit number, and the new offset with which
to continue decoding other data.
Takes unsigned number num and converts it into a VarInt encoded
Uint8Array, returning a tuple consisting of a Uint8Array slice of the
encoded VarInt, and an offset where the VarInt encoded bytes end within the
Uint8Array.
Functions for encoding typed integers in array buffers.