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

@desert-ant-labs/redact

v3.2.0

Published

On-device multilingual PII redaction for JavaScript. Runs in the browser (WebAssembly + LiteRT.js) and server-side in Node (native), from one import.

Readme

@desert-ant-labs/redact

On-device multilingual PII redaction for JavaScript. Finds names, addresses, emails, phone numbers, cards, IBANs, national IDs and more across 27 languages, fully locally. Full language list.

Two entries share one Redact API:

  • @desert-ant-labs/redact (default): a WebAssembly pipeline with LiteRT.js inference (XNNPACK-accelerated CPU by default, optional WebGPU), for the browser. It has no native dependencies, so a single import builds cleanly for every target of a multi-target bundler (Next.js, Remix, SvelteKit, Nuxt), including the browser bundle and the Client-Component SSR pass those frameworks render in Node. It is safe to import during server-side rendering, but LiteRT.js needs a browser (or Web Worker) to initialize, so Redact.load() runs inference only in the browser; calling it in plain Node throws an actionable error pointing you to /native.
  • @desert-ant-labs/redact/native: a prebuilt native core (LiteRT on Linux, Core ML on macOS), for server-side inference in Node. No @litertjs/core, no build tools, no flags. Import it from server-only code (API routes, server actions, plain Node scripts). Do not import it from a component that also renders in the browser.
# Browser (default entry):
npm i @desert-ant-labs/redact @litertjs/core

# Server-side inference in Node (/native entry) needs no extra install:
npm i @desert-ant-labs/redact
import { Redact } from "@desert-ant-labs/redact";

const redact = await Redact.load();            // downloads the model from HF at the pinned tag, cached
const r = await redact.redaction("Email Anna at [email protected].");

r.redactedText;      // "Email [GIVEN_NAME_1] at [EMAIL_1]."
r.items;             // detections: label, original, placeholder, confidence, offsets
const reply = await llm(r.redactedText);       // the LLM sees only placeholders
r.restore(reply);    // originals filled back in

redact.dispose();    // release the model (both builds)

Server-only code that wants the native core imports the same API from the /native subpath:

import { Redact } from "@desert-ant-labs/redact/native"; // server only

Redact.load() accepts:

  • directory: an explicit model directory to self-host / run offline (native build, or the browser build under Node); files already there are used without a download, otherwise the model is downloaded into it. Omit for the managed cache (~/.cache/desert-ant-models/...).
  • modelBaseUrl (browser build): a base URL you serve the model files from (e.g. "/assets/redact/"), loaded instead of the Hub for self-host / offline setups.
  • cacheRoot: base directory for the managed on-disk cache (default ~/.cache; native build, or the browser build under Node).
  • onProgress: download progress callback, fraction in [0, 1].
  • litert (browser): bring-your-own LiteRT.js module (the @litertjs/core namespace, e.g. a bundler-managed import).
  • litertWasmDir (browser): URL/path to the LiteRT.js Wasm files (defaults to the installed package, or the jsDelivr CDN in the browser).
  • accelerator (browser): "wasm" (XNNPACK CPU, default), "webgpu", or "webnn".

By default the model is downloaded from the Hugging Face Hub on first use (at the revision pinned to this package version), SHA-256 verified, and cached for later runs, so nothing model-sized ships in the npm tarball. In Node the cache is the OS cache dir; in the browser it is the fetch cache. Use directory (Node) or modelBaseUrl (browser) to self-host / run fully offline. @litertjs/core is an optional peer dependency (browser builds only).

Choosing what gets redacted

redaction(text, options) accepts:

  • minimumConfidence: minimum score for neural detections (default 0.6). Structured recognizers (email, cards, IBANs, …) always apply.
  • labels: restrict redaction to these categories. Omit for DEFAULT_LABELS.

ORG (company / organisation name) is detected but not redacted by default, because a company is not a natural person. It exists so that names like Silverfin or Odoo are recognised as organisations rather than mislabelled as a SURNAME. Opt in when you do want companies masked:

import { Redact, DEFAULT_LABELS, ALL_LABELS } from "@desert-ant-labs/redact";

await redact.redaction(text, { labels: [...DEFAULT_LABELS, "ORG"] });
await redact.redaction(text, { labels: ["EMAIL", "PHONE"] });  // only these

DEFAULT_LABELS and ALL_LABELS are frozen arrays exported from both entries.

Bundlers and SSR

The default @desert-ant-labs/redact import is safe to use directly in components: it is pure JavaScript + WebAssembly with no native modules, so bundlers can build it for the browser and for the Node SSR pass from the same module graph with no configuration.

The @desert-ant-labs/redact/native subpath loads a native addon (via koffi) and is for server-only code. If you import it inside a framework that bundles server code (for example a Next.js Route Handler or Server Action), mark it external so the bundler does not try to bundle the native binary. In Next.js:

// next.config.js
module.exports = { serverExternalPackages: ["@desert-ant-labs/redact"] };

The native server build ships for linux-x64, linux-arm64 (LiteRT), and darwin-arm64 (Core ML). Other platforms fall back to a clear error at load(); use the default WebAssembly build, the Swift package, or a browser for those.

The same model ships as a Swift package (iOS/macOS) and an Android AAR from the same repository: https://github.com/Desert-Ant-Labs/desert-ant-core

License

Desert Ant Labs Source-Available License 1.0: free below 100,000 monthly active devices per platform; above that a commercial license is required ([email protected]). Full terms: https://license.desertant.com/1.0