univert 0.4.0

Universal file converter (library and CLI)
Documentation

Univert

The universal file converter — a single CLI that converts between 40+ file formats, preferring pure-Rust libraries and shelling out only for tools with no Rust equivalent (LilyPond, OpenSCAD, FFmpeg).

For the desktop version, see univert-gui.

Install

cargo install univert

Usage

univert <input-file> <output-file> [OPTIONS]

Flags:

  • -f, --force — overwrite existing output
  • -l, --list — print every supported conversion and exit
  • -s, --split — split source file into several target files (csv/tsv → json)
  • -h, --help, -V, --version

Examples:

univert notes.json notes.yaml
univert contacts.vcf contacts.json
univert logo.svg logo.png
univert song.abc song.midi          # requires lilypond + abc2ly
univert part.scad part.stl          # requires openscad
univert track.wav track.aac         # requires ffmpeg

Supported conversions

Pure-Rust (no external tool required):

From To
json, yaml, json5, toml, xml, ini each other (via JSON)
csv, tsv html, json, json5, yaml, toml, xml, and each other
xlsx, ods csv, tsv, json, json5, yaml
vcf csv, tsv, json, json5, yaml
ics json, json5, yaml
md html
html md
epub html, md
rtf txt, md
pdf txt
bmp, dds, exr, ff, gif, hdr, ico, jpeg, png, pnm, qoi, tga, tif, webp each other + avif
psd, jp2 any encodable image format
svg png, pdf
stl ↔ obj each other
flac wav
ogg, mp3 wav
midi wav (requires a SoundFont .sf2 on disk)

Shell-out to external tools when available:

From To Required binary
abc, ly midi, pdf, png, ps, svg lilypond, abc2ly
scad csg, off, png, stl openscad
wav aac, mp3, flac ffmpeg

Run univert --list for the complete registry.

Library

use std::path::Path;

let opts = univert::Options { force: true, split: false };
univert::convert(Path::new("in.csv"), Path::new("out.json"), &opts)?;
# Ok::<(), univert::Error>(())

License

AGPL-3.0-or-later