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

std/encoding/binary.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.170.0/encoding/binary.ts";

Functions for encoding binary data in array buffers.

Functions

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.

Interfaces

Options for working with the bigint type.

Options for working with the number type.

Type Aliases

How encoded binary data is ordered.