Menu

1 / 3

I built a smart file assistant that never uploads your files. Here's how it works

DEV Community: productivity·Shubham Builds·12 days ago
#udLhhMXd
#devtoproductivity#devto#dev#file#canvas
Long article (640 words) — no AI summary yet.
Reading 0:00
15s threshold

Most "free" file sites work the same way: you upload your photo or PDF, their server does the work, and you download the result. It works, but it's slow on a bad connection, there's usually a daily limit, and you're handing private files (ID scans, contracts, family photos) to a server you know nothing about.

When I started building DockFlip , I wanted to see how far I could get without a server ever touching the file. Turns out: pretty far. Here's how the main pieces work.

1. Compressing an image to an exact size (like "under 100 KB")

Forms love limits like "max 100 KB". Most compressors give you a quality slider and you guess.

The browser can already do the hard part:

Decode the file with createImageBitmap()

Draw it to a <canvas>

Re-encode it with canvas.toBlob(callback, 'image/jpeg', quality)

To hit a target size, I search for the quality instead of guessing: try the middle, check the blob size, move up or down, repeat a few times.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.