Published
Edited
Jun 29, 2021
Importers
14 stars
Insert cell
Insert cell
license = {
const bytes = new Uint8Array(await FileAttachment("LICENSE.gz").arrayBuffer());
return new TextDecoder().decode(gunzip(bytes));
}
Insert cell
Insert cell
function gunzip(bytes) {
if (bytes[0] !== 0x1f || bytes[1] !== 0x8b || bytes[2] !== 0x08) throw new Error('Not a gzip file.');
let pos = 10; // skip fixed gzip header
let n = bytes[3];
while (n) { // skip extra header fields
while (bytes[pos] !== 0) pos++;
pos++; n = n & (n - 1);
}
return inflate(bytes.subarray(pos));
}
Insert cell
function inflate(bytes) {
const srcStart = 2000;
const mem = new Uint8Array(inflateWasm.mem.buffer);
mem.set(bytes, srcStart);
const dstStart = srcStart + bytes.length;
const dstEnd = inflateWasm.inflate(srcStart, dstStart);
return mem.slice(dstStart, dstEnd);
}
Insert cell
inflateWasm = {
const wasm = FileAttachment("inflate.wasm");
return (await (WebAssembly.instantiateStreaming ?
WebAssembly.instantiateStreaming(fetch(await wasm.url())) :
WebAssembly.instantiate(await wasm.arrayBuffer()))).instance.exports;
}
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more