Scramjet Browser Work
Processing a 10GB log file line-by-line on a server.
The service worker is the heart of the proxy. Create a file (e.g., sw.js ) that imports the Scramjet worker logic and listens for fetch events: javascript
There are two primary ways to utilize Scramjet in the browser: using the (via the client library) or running Standalone Scripts (via the SJS library). scramjet browser work
const outputDiv = document.getElementById("results");
: When you enter a URL, the Scramjet proxy intercepts the request before it leaves your browser. Processing a 10GB log file line-by-line on a server
Because streams are isolated, the browser works in true parallelism, often achieving 5-10x throughput of a Node.js native stream.
Wait—does Scramjet have a DOM at all? Yes, but only as an optional output . If you need to extract data from a standard website (not an API), Scramjet spins up a lightweight headless instance (Puppeteer integration). However, instead of rendering visuals, it serializes the DOM into a stream of Node objects, allowing you to .map() over HTML elements as if they were JSON. const outputDiv = document
: By registering a service worker ( sw.js ), the application can manage the entire session's scope, allowing for seamless navigation within the proxied site. Key Features