smart-database
Version:
This is smart database using firebase . it is only for those students whose learn forntend . they can use firebase as a backend to save own data .
36 lines (29 loc) • 792 B
JavaScript
import { myFile } from "./intializeFirebase";
import {listAll, ref, uploadBytes,getDownloadURL } from "firebase/storage";
class cloudStorage {
constructor() {
// this.storage
}
async uploadFile(file) {
try {
const fileRef = ref(myFile, `files/${1234}`);
let a = await uploadBytes(fileRef, file);
console.log(a)
} catch (error) {
console.log(error.code);
}
}
getImagesURL(){
let allImages = []
listAll(ref(myFile,`files/`)).then((res)=>{
res.items.forEach((result)=>{
getDownloadURL(result).then((r)=>{
if(r) allImages.push(r)
})
})
})
return allImages
}
}
let storage = new cloudStorage();
export { storage };