Reading a million-line file in a browser tab
Workers own the bytes, the main thread owns the pixels, and a scroll position is “line N plus an offset” — not a giant spacer.
Slice and stream
File.slice() gives cheap views into a file. A worker reads 16 MB at a time through a streaming TextDecoder, which carries partial multi-byte characters across slice boundaries — essential for Bengali, where most characters are three bytes in UTF-8.
Index offsets, not strings
The worker stores the byte offset of every line in chunked Uint32Arrays. Fetching lines 4,000,000–4,000,255 is then a single slice and decode.
Search cooperatively
Search runs in the worker, yields to its event loop regularly, streams progress, and cancels by bumping a generation counter — so typing a new query instantly abandons the old one.
Don't trust the scrollbar
Browsers cap element height (around 33 million pixels in Chromium). A spacer-based virtual list breaks long before a million lines at comfortable line heights. Tracking the position as an anchor line plus a pixel offset removes the ceiling — at the cost of drawing your own scrollbar.
Keep reading
Printing from the cloud to a printer on someone else’s Wi-Fi
Why the agent must dial out, how five printer transports differ, and why the bridge refuses to talk to public addresses.
Oct 2026
Offline-first is mostly about conflicts
Caching is the easy part. Notes on field-level patches, stale-write refusal and private data when two phones edit the same book offline.
Oct 2026
Local Bengali speech-to-text
A browser recorder plus a local Whisper server that turns Bengali dictation into an editable transcript and exports it — with no API keys and no audio leaving the machine.
Jun 2026