0

I'm being passed a URL to a Firebase storage file in Cloud Functions, and need to take that URL and get a base64 string from it.

I was using request is taking too long and causing errors, so I'd rather parse the URL, get the file in Firebase storage, and get the base64 string from there.

I tried using admin.storage() but cannot .refFromURL() from there, or fetch the file. It is in nested subdirectories, which I can provide during parsing the URL.

How can I do this?

const passedURL = 'https://{FIREBASESTORAGEPROJECT}.googleapis.com/v0/b/{BUCKET}.appspot.com/o/{FOLDER_NAME_1}/{FOLDER_NAME_2}/{DOCUMENT_NAME}.{EXT}'
admin.storage().refFromURL(passedURL) // not a function
user2521295
  • 823
  • 2
  • 12
  • 23
  • Why are you using base64? – Brad Jul 08 '20 at 21:56
  • Need to pass it to the DocuSign API as an additional document – user2521295 Jul 09 '20 at 00:09
  • Were you by chance just asking about this the other day? I just read another question the other day about someone wanting to add a document via the DocuSign API. I remember looking it up and seeing that the document could be posted separately. Remember, you're adding 33% overhead and wasting memory and CPU by doing this via base64. – Brad Jul 09 '20 at 00:15
  • Not sure but this link https://stackoverflow.com/questions/37352884/save-base64-encoded-image-to-firebase-storage could be helpful for you – Samuel Romero Jul 09 '20 at 14:23
  • @Brad that wasn't me-- what is the more efficient way to add a pdf to a Docusign envelope? Only seeing information about adding via documentBase64 – user2521295 Jul 14 '20 at 01:47
  • @SamuelRomero Thank you-- I need to use admin though since I am working in node/Firebase Cloud Functions – user2521295 Jul 14 '20 at 01:47

0 Answers0