add supabase file server and downloader

This commit is contained in:
polv committed 2026-03-03 21:52:31 +07:00
1 parent cbef2046fd
commit 811dd73e13
8 files changed
+223 -3

No files matched your search

+1
View File
@@ -13,6 +13,7 @@
"dependencies": {
"@fastify/mongodb": "^10.0.0",
"@fastify/static": "^9.0.0",
"@supabase/supabase-js": "^2.98.0",
"adm-zip": "^0.5.16",
"dotenv": "^17.3.1",
"fastify": "^5.7.4",
+28
View File
@@ -0,0 +1,28 @@
import "dotenv/config";
import { createClient } from "@supabase/supabase-js";
const supabaseUrl = process.env.VITE_SUPABASE_URL!;
const supabasePublishableKey = process.env.VITE_SUPABASE_PUBLISHABLE_KEY!;
const supabase = createClient(supabaseUrl, supabasePublishableKey);
async function main() {
const { data, error } = await supabase.storage.from("yomitan").list("ja");
if (error) throw error;
if (data) {
console.log(data.map((d) => d.id));
const toDownload = data.filter(() => true);
console.log(
toDownload.map((d) =>
supabase.storage.from("yomitan").getPublicUrl(`ja/${d.name}`),
),
);
}
}
if (require.main === module) {
main();
}