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

@runer-hq/mdict

v0.1.0

Published

Rust-powered MDict (*.mdx, *.mdd) reader — napi-rs binding

Downloads

112

Readme

MDict Node.js Binding (Rust)

Native Node.js binding for reading MDict dictionary files (*.mdx, *.mdd). Built with napi-rs for near-zero overhead Rust interop. A drop-in Rust-powered replacement for js-mdict.

Install

npm install @runer-hq/mdict

Quick Start

const { Mdx, Mdd } = require('@runer-hq/mdict');

// Open a dictionary
const mdx = new Mdx('/path/to/dict.mdx');

// Look up a word
const result = mdx.lookup('apple');
console.log(result.keyText);     // "apple"
console.log(result.definition);  // HTML definition string

// Prefix search (autocomplete)
const suggestions = mdx.prefix('app', 10);
// [{ keyText: "app" }, { keyText: "apple" }, { keyText: "apply" }, ...]

// Fuzzy search (spell correction)
const fuzzy = mdx.fuzzySearch('aple', 5, 2);
// [{ keyText: "apple", ed: 1 }, { keyText: "aple", ed: 0 }, ...]

// Read resources from .mdd
const mdd = new Mdd('/path/to/dict.mdd');
const css = mdd.readMedia('\\style.css');
console.log(css.mimeType);  // "text/css; charset=utf-8"
console.log(css.data);      // Buffer

CLI

# Install globally
npm install -g @runer-hq/mdict

# Look up a word
mdict /path/to/dict.mdx apple

# Read a resource
mdict /path/to/dict.mdd \style.css

Documentation

Full API reference, data structures, and usage examples: USAGE.md.

Build

cargo build --release -p mdict-node
cp target/release/libmdict_node.* crates/mdict-node/mdict.<platform>-<arch>.node
node node/test.js

Requirements

  • Rust ≥ 1.74 (edition 2021)
  • Node.js ≥ 18 (LTS recommended)

TypeScript Types

Full TypeScript type definitions in index.d.ts.

Architecture

  • src/lib.rs — napi-rs Rust binding (Mdx, Mdd classes + standalone functions)
  • index.js — JS wrapper (loads platform-specific .node binary)
  • index.d.ts — TypeScript type declarations
  • cli.js — Command-line interface

Performance

Compared to the original js-mdict (TypeScript):

| Operation | js-mdict | Rust binding | Speedup | |-----------|----------|--------------|---------| | Load | 299 ms | 223 ms | 1.3× | | lookup | 4,536 ops/s | 4,973 ops/s | 1.1× | | prefix | 18 ops/s | 134 ops/s | 7.4× | | contains | 10,782 ops/s | 28,342 ops/s | 2.6× |

Low-memory mode loads in 2 ms (vs 223 ms eager) by deferring key block decoding.