DEV Community

swift king
swift king

Posted on

I Built a File Converter That Handles 16 Formats in the Browser — No Upload Required

A client once sent me a PDF invoice and asked for it as a CSV. Then sent a HEIC photo that needed to be PNG. Then an XML config that needed JSON. Three different tools, three different uploads, three different privacy policies to read.

I got fed up and built one tool that handles all of it locally.

The Stack

The core is surprisingly simple. Each conversion is an "engine" — a small JavaScript module that takes input and returns output:

  • PDF to JPG: Canvas-based page rendering + per-page export
  • HEIC to PNG: heic2any library, all client-side decoding
  • JSON ↔ CSV: PapaParse for CSV, native JSON.stringify/parse
  • XML ↔ JSON: DOMParser for XML parsing, zero dependencies
  • SVG to PNG: Canvas drawImage with crossOrigin handling
  • Markdown to HTML: marked.js, 2KB minified

16 engines total, all running in the browser at formlyapp.org.

What I Learned

  1. HEIC is everywhere now. iPhone photos come as HEIC by default. Converting them requires the heic2any library which decodes the HEIF container in the browser. The first version crashed on files over 10MB — had to add chunked processing.

  2. PDF rendering is inconsistent across browsers. Each browser renders PDFs slightly differently via Canvas. Firefox handles embedded fonts better than Chrome. Safari sometimes drops transparency. Testing across browsers took longer than writing the code.

  3. File size limits are self-imposed. Most online converters cap at 25-50MB because they process server-side. Browser-local means the only limit is the user's RAM. On a 16GB machine, 200MB files process fine.

The Privacy Angle

I also built single-purpose converters for specific formats:

All of them share the same principle: files stay in browser memory. Open DevTools Network tab while using any of them — zero uploads.

Building browser-local tools taught me that we've normalized sending files to strangers' servers for things our own computers can do faster.

Top comments (0)