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

Functions

Reads n bytes from r.

Encode an integer x into b, and return the number of bytes used. Data-type defaults to int64. Returns 0 if b is too short for the data-type given in o.

Encode a number x into b, and return the number of bytes used. Data-type defaults to int32. Returns 0 if b is too short for the data-type given in o.

Reads an integer from r, comsuming sizeof(o.dataType) bytes. Data-type defaults to int64.

Reads a number from r, comsuming sizeof(o.dataType) bytes. Data-type defaults to int32.

Returns the number of bytes required to store the given data-type.

Decode an integer from b, and return it as a bigint. Data-type defaults to int64. Returns null if b is too short for the data-type given in o.

Decode a number from b, and return it as a number. Data-type defaults to int32. Returns null if b is too short for the data-type given in o.

Writes an integer x to w. Data-type defaults to int64.

Writes a number x to w. Data-type defaults to int32.

Interfaces

Options for working with the bigint type.

Options for working with the number type.

Type Aliases

How encoded binary data is ordered.