npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@types/bencode

v4.0.0

Published

TypeScript definitions for bencode

Downloads

24,105

Readme

Installation

npm install --save @types/bencode

Summary

This package contains type definitions for bencode (https://github.com/webtorrent/node-bencode#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bencode.

index.d.ts

/**
 * Determines the amount of bytes needed to encode the given value.
 */
declare function byteLength(value: any): number;

/**
 * Determines the amount of bytes needed to encode the given value.
 * Alias for {@link byteLength}.
 */
declare function encodingLength(value: any): number;

/**
 * Encodes data in bencode.
 *
 * @param data  Data to encode. Supports Uint8Array, Array, String, Object, Number, Boolean, Map, Set.
 * @param buffer  If provided, the encoded data will be written into this buffer at the given offset.
 * @param offset  Offset into the buffer to start writing.
 * @returns The encoded data as a Uint8Array, or the provided buffer.
 */
declare function encode(data: any, buffer?: Uint8Array, offset?: number): Uint8Array;
declare namespace encode {
    /** The number of bytes written in the last encode call. */
    let bytes: number;
    /** Set to true if a float value was coerced to an integer during encoding. */
    let _floatConversionDetected: boolean;
}

/**
 * Decodes bencoded data.
 *
 * @param data  The bencoded data to decode.
 * @param start  Optional start position in the data buffer.
 * @param end  Optional end position in the data buffer.
 * @param encoding  If provided, byte strings will be automatically converted to strings using this encoding.
 * @returns The decoded data.
 */
declare function decode(data: Uint8Array | string, encoding?: string): any;
declare function decode(data: Uint8Array | string, start?: number, encoding?: string): any;
declare function decode(data: Uint8Array | string, start?: number, end?: number, encoding?: string): any;
declare namespace decode {
    /** The number of bytes consumed in the last decode call. */
    let bytes: number;
}

declare const bencode: {
    byteLength: typeof byteLength;
    encodingLength: typeof encodingLength;
    encode: typeof encode;
    decode: typeof decode;
};

export default bencode;

Additional Details

  • Last updated: Sat, 18 Jul 2026 20:14:50 GMT
  • Dependencies: none

Credits

These definitions were written by Tobenna.