@fileconverter/core
v1.7.0
Published
Universal file conversion CLI and library — images, documents, PDFs, and OCR with pure npm packages
Downloads
255
Maintainers
Readme
@fileconverter/core
A fast, zero-config file conversion CLI. Images, documents, office files, PDFs, and OCR — all powered by pure npm packages with no external system dependencies.
Install
# Run directly (no install needed)
npx @fileconverter/core convert -i photo.png -o output/ --to jpg
# Or install globally
npm i -g @fileconverter/coreUsage
# Convert an image
converter convert -i photo.png -o output/ --to jpg
# Word to PDF
converter convert -i report.docx -o output/ --to pdf
# Excel to HTML
converter convert -i data.xlsx -o output/ --to html
# PowerPoint to text
converter convert -i slides.pptx -o output/ --to txt
# Batch convert a folder of PNGs to WebP
converter convert -i screenshots/ -o optimized/ --to webp --quality 85 -r
# Markdown to PDF
converter convert -i README.md -o output/ --to pdf
# Merge PDFs
converter pdf --merge a.pdf b.pdf c.pdf -o merged.pdf
# Split specific pages from a PDF
converter pdf --split thesis.pdf --pages 1-5,10 -o excerpt.pdf
# OCR: extract text from an image
converter ocr -i scan.png -o result.txt --lang engOffice-to-PDF conversions prefer Microsoft Word for DOCX and RTF files on Windows, then LibreOffice for all supported Office formats. Both preserve document layout more faithfully than the semantic npm fallback. Set
MICROSOFT_WORD_PATHorLIBREOFFICE_PATHto use executables outside the standard install locations. Without either application, FileConverter preserves basic content but not complex layout, fonts, or positioning.
Supported Formats
| Category | Input | Output | |----------|-------|--------| | Images | PNG, JPG, JPEG, WebP, TIFF, BMP, GIF, HEIC | JPG, PNG, WebP, TIFF | | Office | DOCX, XLSX, PPTX, ODT, RTF | PDF, HTML, TXT, Markdown | | Documents | Markdown, HTML, TXT | PDF, HTML, Markdown, TXT | | PDF | PDF | PDF (merge, split, optimize) | | OCR | PNG, JPG, TIFF, BMP, WebP | TXT |
Commands
convert — File conversion
converter convert -i <input> -o <output> --to <format> [options]| Option | Description |
|--------|-------------|
| -i, --in <path> | Input file or folder |
| -o, --out <path> | Output folder |
| -t, --to <format> | Target format (e.g. png, pdf, html) |
| -r, --recursive | Search subfolders recursively |
| --dry-run | Preview without converting |
| --concurrency <n> | Parallel jobs (default: 1) |
| --retries <n> | Retry attempts per job (default: 2) |
| --log-file-json <path> | Save conversion job logs as JSON |
| --log-file-txt <path> | Save conversion job logs as readable text |
| --quality <1-100> | Image quality |
| --max-width <px> | Maximum image width |
| --max-height <px> | Maximum image height |
| --strip-metadata | Remove image metadata |
| --preset <name> | Use a preset (e.g. image/web) |
pdf — PDF operations
converter pdf --compress <file> -o <output>
converter pdf --merge <files...> -o <output>
converter pdf --split <file> --pages <range> -o <output>ocr — Text extraction
converter ocr -i <image> -o <output.txt> [--lang <language>]Presets
| Preset | Quality | Max Size | Strip Metadata |
|--------|---------|----------|----------------|
| image/web | 85 | 1920x1080 | Yes |
| image/print | 95 | 3000x3000 | No |
| image/thumbnail | 80 | 300x300 | Yes |
| image/social | 90 | 1200x1200 | Yes |
| image/original | 100 | — | No |
Requirements
- Node.js >= 18
- No external system programs required
License
MIT — see LICENSE
