Skip to content

Making duckdb-wasm bundle CORS requests #419

Answered by ankoh
llimllib asked this question in Q&A
Discussion options

You must be logged in to vote

The dilemma here is likely, that the creation of cross-origin workers requires some workaround.
(More information here: https://stackoverflow.com/questions/21913673/execute-web-worker-from-different-origin)

I added a tiny helper for that purpose in @duckdb/[email protected].

import * as duckdb from "@duckdb/duckdb-wasm"
const workerScript = "https://cdn.billmill.org/nbastats/dist/duckdb/duckdb-browser.worker.js";
const worker = await duckdb.createWorker(workerScript);

I would, however, recommend to use the jsdelivr bundles since we have multiple workers to get most out of different client browsers.

const allBundles = duckdb.getJsDelivrBundles();
const bestBundle = await duckdb.se…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by llimllib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants