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

x/bencodex/src/decoder.ts>decodeKey

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

Decodes a Bencodex key 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 key bytes.

Returns

An object that represents the end-state of decoding.