Back to UniFile

⚡ UniFile Documentation

Understanding how your files are processed securely

Current capability note: UniFile currently supports browser-native conversion for images and text-based documents. PDF is supported for merging, and multi-file output can be saved directly into a user-selected folder.

Privacy & Security

🔒 Your Files Never Leave Your Device

UniFile processes all files entirely within your web browser. There are no servers receiving your data, no uploads, and no data collection whatsoever. Your privacy is guaranteed by design.

What This Means

Technical Privacy Guarantees

UniFile uses browser-native APIs and WebAssembly to process files. Here's what happens technically:

  1. When you drop a file, it's read into your browser's memory using the FileReader API
  2. Processing happens using JavaScript and WebAssembly libraries running in your browser
  3. The converted file is created as a Blob object in memory
  4. When you download, your browser saves the Blob directly to your device
  5. No network requests are made during any of these steps

How Data Processing Works

Understanding the complete journey of your file from upload to download:

1

File Selection

When you drag & drop or click to select files, the browser's File API creates a reference to your file. The file stays on your disk - only a pointer is created in memory.

2

Format Detection

UniFile reads the file extension and first few bytes (magic numbers) to accurately detect the file format. This determines which processing pipeline to use.

3

File Reading

Using FileReader API, the file is read into browser memory as an ArrayBuffer or DataURL. This is raw binary data that can be processed by JavaScript.

4

Processing

Depending on the file type, different processing engines are used:
• Images: HTML5 Canvas API
• PDFs: pdf-lib WebAssembly library
• HEIC: heic2any converter
• Documents: Showdown for Markdown, DOM APIs for HTML

5

Output Generation

The processed data is converted to the target format and packaged as a Blob object. This is an efficient binary representation that exists only in memory.

6

Download

A temporary object URL is created for the Blob, and the browser's download mechanism saves it directly to your device. The URL is immediately revoked after download starts.

Image Processing

Images are processed using the HTML5 Canvas API, which provides native browser support for image manipulation.

Conversion Process

  1. Load Image: The image is loaded into an HTMLImageElement
  2. Draw to Canvas: The image is drawn onto a 2D canvas context at full resolution
  3. Export: The canvas is exported using canvas.toBlob() with the target MIME type
  4. Quality Control: For lossy formats (JPEG, WebP), the quality parameter is applied during export
// Simplified image conversion process const canvas = document.createElement('canvas'); canvas.width = image.width; canvas.height = image.height; const ctx = canvas.getContext('2d'); ctx.drawImage(image, 0, 0); // Export to target format with quality canvas.toBlob(blob => { downloadBlob(blob, 'output.jpg'); }, 'image/jpeg', 0.9);

HEIC/HEIF Processing

HEIC files (common on iPhones) require special handling since browsers don't natively support them. We use the heic2any library which:

⚠️ Browser Encoding Limitation

UniFile only shows image output formats the browser can create reliably: PNG, JPG, WebP, and PDF. HEIC, HEIF, GIF, BMP, and SVG can be used as inputs where browser support allows, but they are not offered as image output formats.

Document Processing

PDF Operations

PDF processing uses the pdf-lib library, a powerful WebAssembly-based PDF manipulation tool:

// PDF merging with pdf-lib const { PDFDocument } = PDFLib; const mergedPdf = await PDFDocument.create(); for (const file of files) { const pdf = await PDFDocument.load(file); const pages = await mergedPdf.copyPages(pdf, pdf.getPageIndices()); pages.forEach(page => mergedPdf.addPage(page)); } const pdfBytes = await mergedPdf.save();

Markdown Processing

Markdown files are converted using Showdown, a JavaScript Markdown-to-HTML converter:

HTML/Text Processing

HTML and text files are processed using native browser APIs:

Merge Processing (Cross-Format)

UniFile's merge mode allows combining files from different formats into a single output:

🔗 Universal Merge

You can mix images (JPG, PNG, HEIC) with documents (PDF, TXT, Markdown) and merge them all into a single PDF. Each file type is handled appropriately.

How Cross-Format Merge Works

  1. File Detection: Each file's category (image, document, etc.) is detected
  2. Individual Processing: Based on category:
    • Images → Converted to full-page PDF pages
    • PDFs → Pages are copied directly
    • Text/Markdown/HTML → Converted to formatted PDF pages
  3. Order Preservation: Files are added in the order you arranged them (drag to reorder)
  4. Single Output: All pages are combined into one PDF document

Drag-and-Drop Reordering

Before merging, you can drag files in the list to change their order. This determines the page order in the final merged PDF.

Technologies Used

UniFile is built with modern web technologies that enable powerful processing entirely in the browser:

pdf-lib

WebAssembly-based PDF creation and manipulation. Creates, modifies, and merges PDFs without any server.

heic2any

Converts HEIC/HEIF images (iPhone photos) to web-compatible formats like JPEG and PNG.

Showdown

Markdown to HTML converter. Transforms Markdown documents into properly formatted HTML.

Canvas API

Native browser API for image manipulation. Handles format conversion and quality settings.

File API

Browser API for reading files from your device without uploading them anywhere.

Blob API

Creates downloadable file objects entirely in memory for secure, instant downloads.

Why Client-Side Processing?