Skip to content

Commit

Permalink
Replace wget with ts
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvNC committed Jul 12, 2024
1 parent 68b1547 commit 32b0991
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/util/downloadDumps.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { $ } from 'bun';
import { write } from 'bun';
import { exists, mkdir } from 'node:fs/promises';
import { join } from 'path';
import { LanguageCode } from '../constants';
Expand Down Expand Up @@ -39,7 +39,12 @@ export async function downloadDumps(lang: LanguageCode, date: string) {
if (!fileExists && !archiveExists) {
const url = URL(lang, date);
console.log(`Downloading ${url}`);
await $`wget ${url} -O ${archivePath}`;
// await $`wget ${url} -O ${archivePath}`;
const response = await fetch(url);
if (!response.ok) {
throw new Error(`Failed to download ${url}: ${response.statusText}`);
}
await write(archivePath, await response.arrayBuffer());
}

// Extract the archive if it does not exist
Expand Down

0 comments on commit 32b0991

Please sign in to comment.