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

x/bencodex/src/dict.ts

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

This module provides a BencodexDictionary class which implements Dictionary interface. Although an encoder can take any object implementing the Dictionary interface (e.g., a Map object), a decoder always represents a Bencodex dictionary as a BencodexDictionary so that it can guarantee the sensible behavior according to the Bencodex specification.

Classes

A Dictionary implementation that complies with the Bencodex specification. Unlike Map, this implementation allows only keys of type Key and values of type Value, and in particular, it actually compares Uint8Array keys by their contents instead of their references.

A view of a RecordValue that implements Dictionary. It is a handy way to construct a Dictionary using JavaScript's object literal syntax.

Functions

A type guard predicate that checks if the given value is a RecordValue.

Interfaces

A record object that represents a Bencodex dictionary.