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

x/bencodex/mod.ts>decodeValue

An alternative take on implementing Bencodex in TypeScript/JavaScript
Latest
function decodeValue
import { decodeValue } from "https://deno.land/x/bencodex@0.2.2/mod.ts";

Decodes a Bencodex value from the given buffer.

Note that this function does not check whether the given buffer is entirely consumed. You should check the returned DecodingState.read value by yourself to see if the buffer is entirely consumed.

Parameters

buffer: Uint8Array

The buffer that starts with encoded Bencodex bytes.

optional
options: DecodingOptions = [UNSUPPORTED]

Options for decoding.

Returns

An object that represents the end-state of decoding.