Spaces:
Sleeping
Sleeping
Download server/src/utils/uploadFile.ts from Leoj030/express_backend: direct link, hf CLI and curl.
- Browser
- Download file 410 Bytes
-
https://huggingface.co/spaces/Leoj030/express_backend/resolve/main/server/src/utils/uploadFile.ts
- Command line
-
hf download hf://spaces/Leoj030/express_backend/server/src/utils/uploadFile.ts
-
curl -L -o uploadFile.ts https://huggingface.co/spaces/Leoj030/express_backend/resolve/main/server/src/utils/uploadFile.ts
410 Bytes
| import { supabase } from '../config/supabaseClient.js'; | |
| export const uploadFile = async (file: File | Buffer, bucketName: string, fileName: string, fileType: string) => { | |
| const { data, error } = await supabase.storage | |
| .from(bucketName) | |
| .upload(fileName, file, { | |
| contentType: fileType | |
| }); | |
| if (error) { | |
| console.error(error); | |
| return null; | |
| } | |
| return data.id; | |
| } |