Many Changes
This commit is contained in:
BIN
test/supabasestorage/AN.pdf
Normal file
BIN
test/supabasestorage/AN.pdf
Normal file
Binary file not shown.
23
test/supabasestorage/index.mjs
Normal file
23
test/supabasestorage/index.mjs
Normal 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, {
|
||||
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user