Public
Edited
Jan 13, 2022
Importers
26 stars
Insert cell
Insert cell
fflate = import("https://cdn.skypack.dev/fflate?min")
Insert cell
Insert cell
Insert cell
Insert cell
A = fetch(
CORS_PROXY +
"https://data.cquest.org/elections/RG2021/resultats-par-niveau-bv-t1-france-entiere-2021-06-22-11h36.csv.gz"
).then((d) => d.arrayBuffer())
Insert cell
A1 = d3
.dsvFormat(";")
.parse(fflate.strFromU8(fflate.decompressSync(new Uint8Array(A))))
Insert cell
Insert cell
B = fetch(CORS_PROXY + "https://visionscarto.net/obs/jszip-demo/data.zip")
.then((d) => d.arrayBuffer())
.then((buffer) => fflate.unzipSync(new Uint8Array(buffer)))
Insert cell
B1 = Object.fromEntries(
Object.entries(B).map(([key, buf]) => [
key,
d3.csvParse(fflate.strFromU8(buf), d3.autoType)
])
)
Insert cell
Insert cell
b = new Blob([
fflate.zipSync({
// Directories can be nested structures, as in an actual filesystem
dir1: {
nested: { "hello.txt": fflate.strToU8("Hello world!") }
}
})
])
Insert cell
DOM.download(b, "file.zip", "Download this file")
Insert cell
fflate.unzipSync(new Uint8Array(await b.arrayBuffer()))
Insert cell
import { CORS_PROXY } from "@fil/cors-proxy"
Insert cell
Insert cell
evaluate_compressed_size("aaaaaaaaaaaaaaaaaaaaaa")
Insert cell
function evaluate_compressed_size(text) {
if (typeof text !== "string") text = JSON.stringify(text);
return fflate.zipSync({ test: fflate.strToU8(text) }).length;
}
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