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

x/bencodex/src/types.ts

An alternative take on implementing Bencodex in TypeScript/JavaScript
Latest
import * as bencodex from "https://deno.land/x/bencodex@0.2.2/src/types.ts";

This module provides a basic type definitions for Bencodex, and some utility functions for them.

Functions

Checks if the given Bencodex dictionaries have the same keys and the same associated values. In other words, this function checks if the given dictionaries are encoded in the same Bencodex data.

Checks if the given keys have the same type and the same contents. In other words, this function checks if the given keys are encoded in the same Bencodex data.

Checks if the given Bencodex values have the same type and the same contents. In other words, this function checks if the given values are encoded in the same Bencodex data.

Compares two keys in the specified order in the Bencodex specification.

Checks if the given value is a Bencodex dictionary.

Checks if the given value can be used as a key in a Bencodex dictionary.

Interfaces

Represents a Bencodex dictionary. It basically behaves like a read-only Map<Key, Value>, but it is not necessarily a Map instance.

Type Aliases

Represents a value which can be used as a key in a Bencodex dictionary. It is either a string ("text" in Bencodex) or a Unit8Array instance ("binary" in Bencodex).

Represents a Bencodex list. It basically is a read-only Value[].

Represents a value which can be encoded in Bencodex. Each data type in Bencodex has its corresponding type in JavaScript: