I have a requirement to process a file in node to extract some text from that file, my issue is since i am new to node, i don't understand how to pass the path to the file. I am using cloud Function for Firebase so there is no server, hence no directory for files. Is there a workaround? Like using url links instead?
Here's my Node JS code:
exports.extractTextFromPDF = functions
.https.onCall((data, context) => {
const bucket = firebase.storage().bucket()
const file = bucket.file(data.pathLink) //data.pathlink is 'my-pdf.pdf' which is a file inside my storage
return file.download()
  .then(data => {
    return pdfParse(data[0])
  })
  .then(data => {
    file.delete()
    .then(() => {
      return data.text
    })
    .catch(err => console.log(err))
  })
  .catch(err => console.log(err))
})
I understand i can just pass the path to a file in my server, but i have no server! Can i use a url link instead?
If that's not possible, is it possible alternatively to upload a file on the front end and pass that file in node?
I've tried a number of things:
- I've tried passing a url link instead of the path to file - doesn't work 
- I've tried passing the firebase storage bucket path as a path to file - doesn't work 
- I've tried uploading a file from the front end and passing it to node as the file path - doesn't work either 
 
    