How to Generate Large Test Files without Crashing Your Browser
Client-Side Performance Constraints
Generating gigabytes of data inside a browser environment is an engineering challenge. The V8 JavaScript engine enforces strict heap limits (often around 1.4GB - 2GB depending on the system), making standard in-memory generation impossible for large files.
Technique: Stream Processing
The solution lies in abandoning monolithic constraints in favor of Streams and Blobs.
The Blob Interface
A Blob represents immutable raw data. By creating an array of smaller Blobs (chunks) and stitching them together only at the point of download, we avoid loading the entire dataset into the active execution stack.
Web Workers
To prevent the "Page Unresponsive" popup, generation logic must be offloaded to a **Web Worker**. This runs the CPU-intensive generation loops on a background thread, leaving the main thread free to handle UI updates and render progress bars smoothly.
Why This Matters
This architecture allows developers to generate 1GB+ files directly on their local machine without consuming bandwidth or risking network timeouts.
