Published
Edited
1 fork
Importers
23 stars
Hello, PGLiteINSEE ParquetHello, apcachDruidJS workerHello, OrbitWord Tour: 40k words and their friendsHello, spectral.jsHello, petite-vueHello, @thi.ng/grid-iteratorsHello, thumbhashHello, SwissGLHello, QOI (and glitches)Hello, orbHello, cosmographHello, TabulatorUsing d3.blur with PlotMath.cbrtHello debounceColorcetHello, gliiHello, Open MeteoHello, PyWaveletsHello, typesenseHello, libgifHello, kmeans-engineHappy anniversary, Project Gutenberg!Hello, fflateHello, ArchieML!Hello, d3-bboxCollideHello, jsgeoda!Hello, EDTF!Hello, protovis!Hello, placekeyHello, fuse.jsHello, Reorder.jsHello, shadow DOM
jszip
Hello, procedural-glHello, qhullHello, genetic-jsDruidJSHello, Tippy.jsHello, paintWorkletBig πHello, AutoencoderHello, Shakespearean UUIDsHello, ccwt.jsHello, constrainautorHello, talismanHello, polygon-offsetHello p-queueHello async-poolHello rollup-plugin-asciiHello, algebra.jsHello, pixi.jsHello, d3-renderHello zip/unzipCumulative Wikipedia DonationsHTML <details>regl textureHello, npyjsHello protobufHello, pencil touchHello, LOESSHello html2canvaslegra mapscolor2cssHello, ecsy2D point distributionsHello, delatinThe gpu.js loopDijkstra’s shortest-path treeHello nojacko/Dijkstras-jsHello, tcort/dijkstrajsHello, lambdabaa/dijkstraHello, gpu.js v2Hello jsqrHello qrcodeHello SharedArrayBufferHello GamePad APIHello vtk.jsHello nd4jsHello BiofabricTravelling with a self-organizing mapHello glitchHello UMAP-jsHello pandemoniumHello iocaneHello JSON-editorHello d3-griddingHello mljs/knnWorkerHello lalolibImage to GPU.jsImage to blink.jsTissot's indicatrixVega projectionsHello WebCLGLUsing d3-inertia with observableVideo contouring 3ngraph: pagerank, louvain…Union-FindPerceptron (simple statistics)mljsHello h3-jsEmoji FlagsHello, poisson-disk-sampling
Also listed in…
Tools
Insert cell
Insert cell
Insert cell
url = "https://visionscarto.net/obs/jszip-demo/data.zip"
Insert cell
// Using a CORS proxy is sometimes necessary
A = fetch("https://cors-anywhere.herokuapp.com/" + url).then(zipreader)
Insert cell
Insert cell
penguins = A.get("penguins.csv").then(d3.csvParse)
Insert cell
Insert cell
zipreader = (fileDescriptor, { type = "string" } = {}) =>
fileDescriptor
.arrayBuffer()
.then(d => zip().loadAsync(d))
.then(
({ files }) =>
new Map(Object.keys(files).map(f => [f, files[f].async(type)]))
)
Insert cell
reader = zipreader(FileAttachment("datasets.zip"))
Insert cell
cars = reader.get("cars.csv").then(d3.csvParse)
Insert cell
Insert cell
Insert cell
readerUp = up.arrayBuffer()
.then(d => zip().loadAsync(d))
.then(
({ files }) =>
new Map(Object.keys(files).map(f => [f, files[f].async("string")]))
)
Insert cell
dir = [...readerUp.keys()]
Insert cell
Insert cell
zipreader(FileAttachment("arrow.zip"), { type: "arraybuffer" }).then((d) =>
arrow.Table.from(d.get("data.arrow"))
)
Insert cell
Insert cell
// In this example we save several arrays as csv files, and join them together in a zip file
// note: with this method, they don't seem to be compressed
created = {
const z = zip();
const data = {
hello: [{ a: "1", b: 2 }],
world: [{ some: "good", news: "maybe?" }],
cars,
penguins
};
for (let key in data) z.file(`${key}.csv`, d3.csvFormat(data[key]));
return z.generateAsync({ type: "blob" });
}
Insert cell
button(created, "files.zip")
Insert cell
Insert cell
// "https://bundle.run/jszip@3.5.0"
zip = require(await FileAttachment("jszip-3.5.0").url())
Insert cell
d3 = require("d3-dsv@3")
Insert cell
// https://observablehq.com/@jeremiak/download-data-button
button = (data, filename = 'data') => {
if (!data) throw new Error('Array of data required as first argument');

let downloadData;
if (filename.includes('.csv')) {
downloadData = new Blob([d3.csvFormat(data)], { type: "text/csv" });
} else if (filename.includes('.zip')) {
downloadData = new Blob([data], { type: "application/zip" });
} else {
downloadData = new Blob([JSON.stringify(data, null, 2)], {
type: "application/json"
});
}

const size = (downloadData.size / 1024).toFixed(0);
const button = DOM.download(
downloadData,
filename,
`Download ${filename} (~${size} KB)`
);
return button;
}
Insert cell
arrow = require("apache-arrow@6")
Insert cell
import { file } from "@jashkenas/inputs"
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