Skip to Content
Platform.Ontology

Compression Streams

Compresses or decompresses data in the page with built-in gzip, deflate or deflate-raw.

Works without askingThings a page can doComputeWeb browsersWhile you use it

In one line

Can squeeze or unpack data in the page with the browser's built in compression

Compresses or decompresses data in the page with built-in gzip, deflate or deflate-raw.

A site can shrink or expand data without a library. It also lets trackers pack fingerprint payloads before sending them out.

What it can and can't do

What the user does: Nothing. It happens when a site's script compresses logs, files or data

It can

  • Compress data with gzip or deflate before sending it
  • Unpack compressed files in the page
  • Shrink payloads, including tracking data, before they go out

It cannot

  • See your files unless you chose them
  • Send anything by itself, only change data the page already has
  • Be turned off from your browser settings
  • Do heavy work forever, since large tricks can hit memory limits

Browser support

BrowserStatusFirst versionReleasedNote
ChromeSupported802020-02-04None
EdgeSupported802020-02-07None
FirefoxSupported1132023-05-09None
SafariSupported16.42023-03-27None
Safari on iPhoneSupported16.42023-03-27All iOS browsers use WebKit
Chrome on AndroidSupported802020-02-04None
Samsung InternetSupported13.02020-12-02None

How a site asks for it

APInew CompressionStream('gzip'); new DecompressionStream('deflate')
Browser compat keysapi.CompressionStream
api.DecompressionStream
How access is grantednone
What the user seesNone (no browser prompt)
Needs a secure context (HTTPS)No
Needs a user gestureNo
Activationnone
How long it lastsNone
How to take it backNothing to revoke (no permission is stored)
Inside an iframeNo iframe flag; available in workers

Typical flow

  1. Create CompressionStream
  2. Pipe a ReadableStream through it
  3. Read the compressed stream

Data you get

Shape: none

No individual data fields. The signal is the access itself.

Technical limits

  • Formats: gzip, deflate, deflate-raw (brotli not in the spec baseline)
  • Streaming only, no password or zip container; browser does not compress files on disk
  • DecompressionStream has no output cap; zip bomb risk fills memory
  • Support: Chrome 80, Safari 16.4, Firefox 113

The story

What it is

A page can squeeze or unpack data with built in compression, so it sends less over the network.

For you

You never see it. Pages that use it send smaller uploads and open big files faster. It saves time and data.

For makers

Makers drop heavy compression libraries and ship less code. It speeds up uploads, saves and downloads. The same trick can hide the size of data a script sends out, which tracking code can use.

Where you see it

TypeExampleApps
gamesA browser game compresses save files before uploading them to the cloud, so saves are quick on mobile data.None named
productivityA web editor compresses documents before sync and saves bandwidth.Google Docs
creativeA web design tool unpacks large project files in the browser.Figma
videoA web video app packs frames or clips before an upload.None named
analyticsAn analytics script compresses batches of events before sending them in one request.None named
developerA web tool lets you drag in a zip or gzip file and view its contents in the page.None named
adsA tracking script packs a large fingerprint into a small request that is hard to spot.None named

Risks

  • Hides data size
  • Little risk

What the platform says

Good uses and abuse

Legitimate uses

  • Uploading logs
  • In-browser archive tools
  • Smaller payloads

Known abuse

  • Obfuscated telemetry payloads
  • Memory exhaustion with a decompression bomb

Scores

ScoreValueMeaning
Sensitivity1 of 5How revealing the data is
Utility3 of 5How useful it is to honest apps
Friction0 of 5How much the user has to do
Fingerprint bitsNot ratedRough identifying entropy, when known

History

  • 2020-02, Chrome 80: Compression Streams ship
  • 2023-05, Firefox 113: Compression Streams ship

Sources

How well checked: Based on official documentation.

On this page