@zhconv/cli
v0.4.2-2
Published
Native CLI for zhconv — convert Chinese between Trad/Simp and regional variants
Readme
@zhconv/cli & @zhconv/cli-opencc
Native CLI for zhconv-rs — convert Chinese text between Traditional, Simplified and regional variants. Powered by MediaWiki and OpenCC rulesets with an Aho-Corasick automaton for single-pass linear-time conversion.
Install / Use
# Default (MediaWiki dicts, smaller binary)
npx @zhconv/cli zh-tw < input.txt
# OpenCC variant (MediaWiki + OpenCC dicts, larger binary)
npx @zhconv/cli-opencc zh-tw < input.txtRequires Node.js 18+. The first run downloads the matching native binary for your platform (linux x64/arm64, darwin x64/arm64, windows x64/arm64).
Variants
@zhconv/cli— uses MediaWiki conversion tables (smaller binary, ~3 MB).@zhconv/cli-opencc— includes BOTH MediaWiki and OpenCC tables (larger binary, ~5 MB). This matches Python'szhconv-rs-openccpackage: it adds OpenCC dicts to the default MediaWiki dicts rather than replacing them. Use this if you need OpenCC-specific phrases (e.g., TW colloquialisms).
Usage
See the GitHub repository for full documentation, CLI options, and usage examples.
How it works
@zhconv/cli is a tiny launcher (Node.js) that resolves a platform-specific @zhconv/cli-<platform> sub-package containing the actual Rust binary, then spawns it. npm's optionalDependencies mechanism auto-installs only the binary for your platform — no download scripts, no curl | bash.
License
GPL-2.0-or-later (same as the underlying Rust crate). Conversion tables sourced from MediaWiki (GPLv2.0+) and OpenCC (Apache-2.0).
Related
zhconv— JS/wasm library for browser/Node usagezhconv-web— browser ESM buildzhconv-rs— Python bindings- GitHub repository
