mirror of
https://github.com/patarapolw/cjdic2.git
synced 2026-11-08 17:35:18 +00:00
32 lines
898 B
TypeScript
32 lines
898 B
TypeScript
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);
|
|
// no sha256, but may be precomputed and manually placed at data[*].metadata.*
|
|
// data[*].metadata.{size,contentLength} could be meaningful
|
|
// GitHub releases uses digest: 'sha256:*' in assets[*].digest currently
|
|
|
|
const toDownload = data.filter(() => true);
|
|
|
|
console.log(
|
|
toDownload.map((d) =>
|
|
supabase.storage.from("yomitan").getPublicUrl(`ja/${d.name}`),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
if (require.main === module) {
|
|
main();
|
|
}
|