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

lottie-doctor

v0.2.0

Published

Diagnose and repair broken Lottie files. Fixes garbled CJK/Unicode text (NFD→NFC) that other optimizers ignore, plus size optimization. CLI + library + GitHub Action.

Readme

lottie-doctor 🩺

CI npm

Diagnose and repair broken Lottie files — not just shrink them.

🩺 Try it in your browser →

Every other Lottie tool only makes files smaller. lottie-doctor is the only one that also fixes them: it repairs corrupted CJK/accented text — including double-encoded "mojibake" (UTF-8 bytes misread as Latin-1 and re-saved) and Unicode decomposition (NFD) — the classic bugs you get when a designer exports Korean/Japanese layer names from After Effects on macOS.

Real example from a shipping app: a character layer named ("hand") was stored in the JSON as 4áá©á« — completely corrupted. lottie-doctor recovers it to 4손. NFC-only optimizers can't: the text isn't decomposed, it's byte-level mangled.

npx lottie-doctor check animation.json
npx lottie-doctor fix animation.json

Why this exists

Lottie JSON exported from After Effects is routinely broken in two ways:

  1. Corrupted text. Two failure modes, both passing as "valid UTF-8" so every optimizer ignores them:
    • Mojibake (double-encoding): the bytes of get misread as Latin-1 and re-saved, becoming áá©á«. Recoverable by re-interpreting the bytes.
    • Decomposition (NFD): 온보딩 is stored as separate jamo (ㅇㅗㄴㅂㅗㄷㅣㅇ) that render broken. Recoverable via NFC. Existing tools (lottie-optim, TinyLottie, Lottiemizer, …) do nothing about either.
  2. Bloat. 15-digit float spam and raster PNGs base64-encoded inside the "vector" JSON, easily pushing a single mascot animation past 1 MB.

lottie-doctor does the lossless text repair first (mojibake → NFC), then optionally trims the bloat.

Mojibake repair is deliberately conservative — it only fires when a string carries an unambiguous corruption signature (C1 control bytes) and re-decodes cleanly, so legitimate accented text like café is never touched.

What it does

| Check | lottie-doctor | typical optimizers | | --- | :---: | :---: | | Repair double-encoded text (mojibake) | ✅ | ❌ | | Repair decomposed Unicode (NFD → NFC) | ✅ | ❌ | | Works on .lottie (dotLottie ZIP) archives | ✅ | partial | | Detect embedded raster images | ✅ | partial | | Round float precision | ✅ (opt-in) | ✅ | | Strip editor-only metadata | ✅ (opt-in) | ✅ | | Fail CI on unhealthy files | ✅ | ❌ |

CLI

# Diagnose (exits 1 if anything is wrong — drop it straight into CI)
lottie-doctor check src/assets/*.json --max-size 500

# Repair text (mojibake + NFC, safe & lossless) → animation.fixed.json
lottie-doctor fix animation.json

# Repair + shrink, overwriting in place
lottie-doctor fix animation.json --write --precision 3 --strip-meta

# Works on dotLottie ZIP archives too → animation.fixed.lottie
lottie-doctor fix animation.lottie

Both commands accept raw .json and .lottie (dotLottie ZIP) files. For .lottie, every packed animation is repaired and the archive is repacked with all other entries (manifest, images, themes) preserved byte-for-byte.

check output

temi_large.json  15.3 KB
  ✖ encoding   25 double-encoded string(s) (mojibake) — corrupted text
       e.g. "4áá©á«" → "4손"
  ⚠ precision  68 number(s) over 3 decimals — try fix --precision 3
  → run: lottie-doctor fix temi_large.json

Library

import { analyze, fix } from "lottie-doctor";

const report = analyze(jsonString);
if (report.encoding.nonNfc > 0) {
  const { data } = fix(jsonString); // NFC repair, returns a clean copy
}

fix() never mutates your input and is idempotent. Text repair (mojibake + NFC) is on by default; precision and stripMeta are opt-in.

For dotLottie archives, use the byte-oriented variants:

import { analyzeDotLottie, fixDotLottie } from "lottie-doctor";

const bytes = new Uint8Array(await file.arrayBuffer());
const { data } = fixDotLottie(bytes); // returns repacked .lottie bytes

The library is isomorphic — it runs in Node and the browser (the demo above is the same code, no server).

Roadmap

  • [x] GitHub Action (lottie-doctor/check@v1) for CI
  • [x] .lottie (dotLottie ZIP) support
  • [x] Web playground with before/after preview
  • [ ] Embedded-image externalization & re-compression (the big size win)
  • [ ] Widen mojibake detection to Latin-1 accents (no C1 signature)

License

MIT