From d72f0c3dd7695a6a6afdb46fae836dd6f25156c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Sun, 20 Oct 2024 20:08:50 +0200 Subject: [PATCH] Update src/duckdb.ts Co-authored-by: Mike Bostock --- src/duckdb.ts | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/src/duckdb.ts b/src/duckdb.ts index be5c1efd5..4d884b204 100644 --- a/src/duckdb.ts +++ b/src/duckdb.ts @@ -62,36 +62,3 @@ export async function resolveDuckDBExtension(root: string, p: string, repo: stri downloadRequests.set(cachePath, promise); return promise; } - -/* - promise = Promise.all( - bundles.map(async (p) => { - const outputPath = join(outputDir, `${name}.${p}.wasm`); - console.log(`download: ${href} ${faint("→")} ${outputPath}`); - const response = await fetch(href); - if (!response.ok) throw new Error(`unable to fetch: ${href}`); - await mkdir(dirname(outputPath), {recursive: true}); - await writeFile(outputPath, Buffer.from(await response.arrayBuffer())); - }) - ).then(async () => { - const ref = await duckDBHash(name, files); - for (const [i, p] of bundles.entries()) { - const targetPath = join(cache, ref, "v1.1.1", `wasm_${p}`, `${name}.duckdb_extension.wasm`); - await mkdir(dirname(targetPath), {recursive: true}); - await copyFile(files[i], targetPath); - } - return ref; - }); - promise.catch(console.error).then(() => files.forEach((file) => downloadRequests.delete(file))); - downloadRequests.set(key, promise); - return promise; -} - -async function duckDBHash(name: string, files: string[]): Promise { - const hash = createHash("sha256"); - hash.update(name); - for (const file of files) hash.update(await readFile(file, "utf-8")); - return join("_duckdb", `${name}-${hash.digest("hex").slice(0, 8)}`); -} - -*/