<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Save From Internet</title>
    <description>The latest articles on DEV Community by Save From Internet (@savefrominternet).</description>
    <link>https://dev.to/savefrominternet</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4140646%2Fc615aa82-97c7-4631-9ace-a1df02afb9a6.jpg</url>
      <title>DEV Community: Save From Internet</title>
      <link>https://dev.to/savefrominternet</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/savefrominternet"/>
    <language>en</language>
    <item>
      <title>Building 50 File Tools That Never Upload Your Files: 6 Browser Gotchas</title>
      <dc:creator>Save From Internet</dc:creator>
      <pubDate>Tue, 17 Nov 2026 12:06:09 +0000</pubDate>
      <link>https://dev.to/savefrominternet/building-50-file-tools-that-never-upload-your-files-6-browser-gotchas-3jl4</link>
      <guid>https://dev.to/savefrominternet/building-50-file-tools-that-never-upload-your-files-6-browser-gotchas-3jl4</guid>
      <description>&lt;p&gt;What I learned moving image and video processing into the browser with Next.js 16, WebCodecs and WebAssembly.&lt;/p&gt;

&lt;p&gt;I run a video downloader site, and this autumn I added 50 file tools to it: image compression, HEIC to JPG, video to MP3 and GIF, trimming, a ringtone maker, a background remover,&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg7ntyh9fkxmhetzj26n2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg7ntyh9fkxmhetzj26n2.png" alt=" " width="800" height="336"&gt;&lt;/a&gt; and more. The rule I set was simple: the user's file never touches my server. Everything runs in the browser.&lt;/p&gt;

&lt;p&gt;It mostly worked. These are the six things that didn't, and how I fixed them.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Chrome "supports" AVIF export by giving you a PNG&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;canvas.toBlob(cb, 'image/avif')&lt;/code&gt; doesn't throw in Chrome. Per the spec, an unsupported type falls back to PNG, so you get a valid blob with the wrong format. My first version happily saved PNG bytes with a &lt;code&gt;.avif&lt;/code&gt; name.&lt;/p&gt;

&lt;p&gt;Fix: always check &lt;code&gt;blob.type&lt;/code&gt; against what you asked for. When AVIF comes back as something else, I load an AVIF encoder compiled to WebAssembly (jSquash's libavif build) with a dynamic import, so only people who need it download it. Safari can write AVIF natively and never loads it.&lt;/p&gt;

&lt;p&gt;Bonus gotcha: the package's normal entry point runs a feature check that embeds WebAssembly as a data URL, and Turbopack refused to bundle it. Importing the single-threaded codec directly avoided that. The threaded build needs cross-origin isolation anyway, which would break third-party scripts.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;iOS Safari has a canvas size limit&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Safari on iPhone won't create a canvas bigger than 16,777,216 pixels. Go over it, and you don't get an error; you get a blank image. A 48-megapixel iPhone photo is well past that.&lt;/p&gt;

&lt;p&gt;Fix: compute the pixel count before drawing, and scale down to fit under the limit. I keep the limit as a named constant so every tool checks it the same way.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Phone videos came out stretched&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Videos recorded on phones are often HEVC with rotation metadata. When I resized them to a new aspect ratio with a "fill" fit, they stretched. The fix was to compute the output size from the video's own metadata and use "cover" (crop to fill) rather than "fill" (squash to fill).&lt;/p&gt;

&lt;p&gt;The video work itself uses Mediabunny on top of WebCodecs, which made trimming, compressing, and converting surprisingly short to write.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;"Compress to 50 KB" is a search problem&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;JPEG quality doesn't map to file size in any predictable way. To hit a target like 50 KB, I binary-search the quality setting, re-encoding until the result lands just under the target, then shrink the dimensions only if even the lowest acceptable quality is too big. Six or seven encodes usually find it.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Phone testing failed for a silly reason&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Uploads worked on desktop and did nothing on my phone. The page loaded, but nothing was interactive. Next.js blocks its dev scripts for origins it doesn't know, and my phone was on a different LAN address than the one in &lt;code&gt;allowedDevOrigins&lt;/code&gt;. Reading the machine's addresses at startup fixed it. Hours lost, one line changed.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;My CSS was shipped three times&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;With Next's experimental &lt;code&gt;inlineCss&lt;/code&gt;, each page carried its stylesheet in a &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; tag and twice more in the React payload. On top of that, importing one small component from my toolkit's index file pulled in every tool's CSS. Turning &lt;code&gt;inlineCss&lt;/code&gt; off and importing the component directly took the homepage from 95 KB to 31 KB gzipped, with the same or better LCP.&lt;/p&gt;

&lt;p&gt;Was it worth it?&lt;/p&gt;

&lt;p&gt;Yes. No upload means no waiting on mobile data, no storage bill, and nothing to leak. The tools are free at &lt;a href="https://www.savefrominternet.com/tools" rel="noopener noreferrer"&gt;savefrominternet.com/tools&lt;/a&gt;. If you've hit other browser gotchas doing this kind of work, I'd like to hear them.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>webassembly</category>
      <category>nextjs</category>
    </item>
  </channel>
</rss>
