I am working with Cloud Storage for Firebase and can't figure out how to to access storage files
According to https://firebase.google.com/docs/storage/web/start official guide and https://firebase.google.com/docs/storage/web/create-reference this code should be returning root reference
let admin = require('firebase-admin')
admin.initializeApp({...})
let storageRef = admin.storage().ref()
But it throws an error saying
TypeError: admin.storage(...).ref is not a function
package.json
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {...},
"dependencies": {
"@google-cloud/storage": "^1.5.1",
"firebase": "^4.8.0",
"firebase-admin": "~5.4.2",
"firebase-functions": "^0.7.1",
"pdfkit": "^0.8.3",
"uuid": "^3.1.0"
},
"private": true
}
node -v => v7.7.4
My end goal it to download files or upload a pdf file to storage.
bucket = admin.storage().bucket()
, functions admin does not use the web apis – Linxybucket.file('images/snow.jpg')
but i want to return/download file in response of cloud function. Can you guide? – Abdullahbucket.file('images/snow.jpg').getDownloadURL()
but it saysbucket.file(...).getDownloadURL is not a function
– Abdullahclient_email
. where can I configure client_email ? – rainversion_3