I know there many duplicates which ask similar questions but for the past 2 hours I have tried and surfed the internet for a single line of code has piled my frustration. I am sorry but please help me out. Here is what I have tried up until now, it gives this error:
Error
38:22 error Parsing error: Unexpected token firebase
Code
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
const spawn = require('child-process-promise').spawn;
const path = require('path');
const os = require('os');
const fs = require('fs');
exports.getDownloadUrl = functions.region("asia-south1").storage.object().onChange(event => {
const object = event.data;
const fileBucket = object.bucket;
const filePath = object.name;
const bucket = gcs.bucket(fileBucket);
const contentType = object.contentType;
const resourceState = object.resourceState;
const tempFilePath = '/test/air.jpg';
return {
message: await firebase.storage().ref(tempFilePath).getDownloadUrl // line 38
};
});
I just want to get a download url from the given file path.