Published
Edited
Jun 18, 2021
Insert cell
Insert cell
region = 101
Insert cell
url = 'https://raw.githubusercontent.com/cornhundred/testing_something/master/transcripts_csv_zip/' + String(region) + '.csv.zip'
Insert cell
fetch(url).then(x => x.arrayBuffer())
.then(x => jszip.loadAsync(x))
.then(x => {
const file = Object.keys(x.files)[0];
return x.file(file).async("string").then(x => d3.csvParse(x, d3.autoType));
})
Insert cell
data.length
Insert cell
data[0]
Insert cell
data = {
const buf = await jszip.loadAsync(content);
const file = Object.keys(buf.files)[0];
return buf.file(file).async("string").then(x => d3.csvParse(x, d3.autoType));
}
Insert cell
// fetch_results = fetch(url)
content = fetch(url).then(x => x.arrayBuffer())
Insert cell
// content = results.arrayBuffer()
// content = fetch_results.arrayBuffer()
Insert cell
// results = fetchp(url, {
// 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
Insert cell
jszip = require("jszip@3/dist/jszip.min.js")
Insert cell
import { fetchp } from '@tomlarkworthy/fetchp'
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