Many Changes

This commit is contained in:
2024-02-01 21:00:59 +01:00
parent fe74e7d91b
commit 34d1eb9c71
18 changed files with 493 additions and 374 deletions

BIN
test/supabasestorage/AN.pdf Normal file

Binary file not shown.

View File

@@ -0,0 +1,23 @@
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, {
})