mirror of
https://github.com/patarapolw/cjdic2.git
synced 2026-11-09 17:39:35 +00:00
add supabase file server and downloader
This commit is contained in:
1 parent
cbef2046fd
commit
811dd73e13
8 files changed
+223
-3
No files matched your search
@@ -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();
|
||||
}
|
||||
Reference in new issue
Block a user