Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 4.6 — Data from Cloud Storage (S3 or GCS)
Data Visualization · Example 2 of 2

How much does gzip save?

Classic script (no import), so the code sits inside an async function. Sizes are the real bytes of the course files.

Later the data will live in cloud storage instead of your project folder. Only one line of config changes, but the browser then enforces CORS, caching and size rules you must understand. Keys and secrets never go in frontend code.

Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.

Ready for more? This phase has 5 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

Write dataUrl(base, file) so that dataUrl("/data/lumen", "/daily.csv") and dataUrl("/data/lumen/", "daily.csv") both give /data/lumen/daily.csv.

02

A teammate sees Failed to fetch for the bucket URL but the file opens in a new tab. Name the likely cause and the first place to look.

Explain it without notes

01

Why does moving the data to a bucket change only one line of code?

02

What does the browser do when a response has no Access-Control-Allow-Origin header, and what does your code see?

03

Why must a secret key never appear in frontend code, and what do you use instead?

How much does gzip save?

Preview

Press Run to see the page.

Console

Nothing logged yet.

Expected console output

stations.csv            1414 bytes     555 gzipped   39%
daily.csv              13406 bytes    4587 gzipped   34%
hourly-june.csv        19334 bytes    3444 gzipped   18%
trips-10k.csv         487313 bytes  146324 gzipped   30%
bikes.json             24053 bytes    2790 gzipped   12%
routes.json             3932 bytes     661 gzipped   17%
ardenvale.topojson      2684 bytes    1089 gzipped   41%
world-110m.json       107761 bytes   38423 gzipped   36%