import {createClient} from "@supabase/supabase-js"; import { v4 as uuidv4 } from 'uuid'; import * as fs from "fs"; const supabase = createClient("http://localhost:54321", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0") const currentTenant = 1 console.log(await supabase.storage.listBuckets()) let files = (await supabase.storage.from('files').list(currentTenant)).data files.forEach(async (file) => { console.log(await supabase.storage.from('files').getPublicUrl(file.name)) }) const file = fs.readFileSync('AN.pdf','utf8') const fileId = uuidv4() const {data,error} = await supabase.storage.from('files').upload(`${currentTenant}/${fileId}/AN.pdf`,file, { })