Mechanism◆Article
fetch() can be called directly on a data: URI, with the response body piped through a DecompressionStream to decode deflate-raw compressed data in the browser.
The code snippet reveals that fetch() works on data: URIs, and its response body can be piped through DecompressionStream('deflate-raw') to decompress the embedded base64 map data into HTML on the fly. ✦ AI generated
Simon Willison · Simon Willison's Weblog · 2026-07-04 · original ↗
I didn't know you could use fetch() with data: URIs like this: fetch('data:;base64,1ZpLsgIxCEXnrM...==').then( r => r.body.pipeThrough(new DecompressionStream('deflate-raw')) ).then( s => new Response(s).text() ).then( t => b.innerHTML = '<pre style=font-size:.65vw>' + t )
Read full article ↗excerpt · fair-use quotation
- ·fetch() can take a data: URI directly, not just URLs
- ·Response body is a stream, pipeable like any fetch result
- ·Discovered by Simon Willison in a code snippet
- ·Body piped through DecompressionStream('deflate-raw')
- ·Decodes embedded base64 map data in the browser
- ·Result converted to text via new Response(s).text()
- ·Final text injected directly into innerHTML
Around this claim