Browser Internals7 min readUpdated: 2026-11-06

Inside HTML5 File API & Blob Object URLs: Zero-Copy Streaming vs. Base64 FileReader

Deep technical comparison between FileReader.readAsDataURL() Base64 overhead and zero-copy URL.createObjectURL() pointers, Same-Origin isolation, and explicit memory revocation.

How can a web browser begin playing a 500 MB 4K video within milliseconds of a drag-and-drop gesture—and why does the generated blob:https://... address look like a web URL even though nothing was uploaded? Understanding the W3C File API's zero-copy Blob URL store and Same-Origin security boundary answers both questions.

1. Browser Sandboxing & User-Mediated File Handles

Web JavaScript executes inside an isolated OS sandbox with zero arbitrary filesystem access; scripts can never scan directories on their own. Only when a user performs an explicit gesture—selecting files via <input type="file"> or dropping items onto a drop target—does the browser mint read-only File handles scoped strictly to those chosen files.

2. Base64 FileReader vs. Zero-Copy URL.createObjectURL() Pointers

Developers have two ways to feed a local File into an <img> or <video> element, with drastically different memory characteristics:

MetricFileReader.readAsDataURL()URL.createObjectURL() (Tile Viewer)
Output Representationdata:video/mp4;base64,AAAAIG... (massive string)blob:https://tile-viewer-web.com/550e8400... (UUID)
Memory Overhead~133% Base64 inflation inside JS string heapZero inflation (lightweight pointer handle)
Creation Latency (500 MB clip)Multi-second UI freeze or V8 string-limit crash< 1 ms O(1) descriptor registration
Video Seeking & StreamingMust buffer entire file into memory upfrontStreams byte ranges on demand from local disk

3. Same-Origin Isolation & Process Scoping of blob: URLs

  • Local Browser Process Only: Sharing a blob: URL string with another computer—or even pasting it into a different browser on the same machine—returns ERR_FILE_NOT_FOUND.
  • Strict Origin Binding: The embedded origin ensures no external website tab can dereference pointers created inside your Tile Viewer session.
  • Automatic Tab Teardown: Closing or refreshing the browser tab immediately purges the entire document Blob URL table.

4. Deterministic Memory Cleanup with URL.revokeObjectURL()

Because the browser cannot guess when a script is finished using a blob: URL during a single-page session, JavaScript garbage collection will not free the underlying file reference automatically. Tile Viewer explicitly invokes URL.revokeObjectURL(url) whenever you remove an individual card, clear the workspace, or unmount the view—keeping long curation sessions lean and responsive.

Try It Live in Your Browser

Test These Concepts Live in Tile Viewer

No installation or sign-up required. Drop your own local images and videos to test shortest-column masonry, 50% neutral gray contrast, RGBA memory math, and 5-color HEX extraction with zero network uploads.

Related Technical & Creative Guides

View All