Reference
Architecture
A single CLI runner on commander with two commands, image-hash and image-batch, and a ui command that starts the web interface. Each command is self-contained: its own flag parsing, its own core-logic module and its own report renderer. They share an output module (banner, color, aligned tables), the --dry-run-first safety model and the loader of sharp.
sharp is a regular dependency, so npm installs its prebuilt binary with the package. It is still loaded lazily, only once there is an image to decode: first from next to mediatoolz, then from the project, then from a managed copy under ~/.mediatoolz/deps, which the command offers to create when none is found (--yes agrees up front). The hash algorithms (hazehash, blurhash, thumbhash) are small pure-JavaScript dependencies; the heavy decoding is sharp's alone.
image-batch plans before it writes: every source is read for its real dimensions, every size, format and file name is computed, name clashes are detected, and only then are files encoded, in a limited number of parallel jobs. That is what lets --dry-run and the interface's preview show real numbers, and what keeps --replace safe: the originals are copied to a dated folder with a journal first, and a file is replaced only when the result is smaller.
The web interface is a small local server (127.0.0.1, one-time token) with a Vue page built into the package. It calls the same functions as the commands, so the interface and the command line cannot drift apart.
Comparison
mediatoolz does not replace a build-time image pipeline of a bundler, and it is not a service: it is a command you run on a folder when you need a set of files, with the rules kept in a config you can reuse. The placeholders it makes are the ones Vue Image Kit shows while an image loads, and --emit writes the manifest that package reads. The code checks that used to live next to these commands stayed in DevToolz.
Development
git clone https://github.com/macrulezru/mediatoolz.git
cd mediatoolz
npm install
npm testTests run against real temporary folders with real images, so they catch what a mock would not. The commands for everything else:
npm run build # tsc -> dist/, and the web interface
npm run typecheck # tsc --noEmit, and the interface
npm run lint # eslint .
npm run format # prettier --check .License
MIT — see LICENSE.