I am using firebase functions and I want to create a function which will get a base64 image and will save it into the storage. I did some research and apparently I am supposed to use something like firebase.storage().ref()
The problem is I don't know what object this 'firebase' is, and how I can i get it? For all of my other functions I used 'firebase-functions' and 'firebase-admin'. I managed to upload the image using the admin but its uploaded badly and I can't get the image back later.
Here is the code I used for it:
export const uploadImage = functions.runWith(runtimeOpts).https.onRequest(async (req, res) => {
const bucket = admin.storage().bucket()
const file = bucket.file(`users/${email}`);
file.save("my base64 image", {
contentType: "image/jpeg"
}, (err) => {
if (err) {
throw err;
} else {
functions.logger.debug("NO WAY!")
}
})
}