Published unlisted
Edited
May 18, 2021
2 forks
Insert cell
Insert cell
Insert cell
results = fetchp(insee_csv_zipped, {
headers: {
'x-requested-with': "observablehq.com" // Upstream blocks us without this, silly
},
responseHeaders: {
'transfer-encoding': null, // Its trying to send them in a chunked reponse which is not working ATM
'Cache-control': `public, max-age=${24 * 7 * 3600}` // We can cache at the proxy level now too!
}
})
Insert cell
content = results.arrayBuffer()
Insert cell
unzip = {
const buf = await jszip.loadAsync(content);
const file = Object.keys(buf.files)[0];
return buf.file(file).async("string");
}
Insert cell
Insert cell
// deploy the subset as a csv
deploy("insee_bdm_idbanks_150521.csv", async (req, res) => {
res.header("Cache-control", `public, max-age=${24 * 7 * 3600}`); //
res.header("Content-Type", "text/plain");
res.send(unzip);
})
Insert cell
Insert cell
jszip = require("jszip@3/dist/jszip.min.js")
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more