Firebase cloud function to send a file to browser as 'download'

635 views
Skip to first unread message

veera.k...@gmail.com

unread,
Apr 27, 2019, 11:09:18 AM4/27/19
to Firebase Google Group
I have a JavaScript application which compiles a JSON object and sends it to my Firebase cloud function. This function will process the JSON object and creates an XML file and will send this XML file back to browser as a 'downloadable' file.

In Express.js, I could do this with the help of `response.download` [https://expressjs.com/en/api.html#res.download] function. Is there something similar exist in Firebase functions? Please note, my functions are callable function (not the HTTP ones).

Sam Stern

unread,
Apr 29, 2019, 11:53:42 AM4/29/19
to Firebase Google Group
Hi there,

That's an interesting question, thanks for the feedback.  Right now there is no way to do this, callable functions must return an object with a "data" property.  This is unlikely to change since callable functions support Android and iOS as well, where a "download" type would not make any sense.  Have you tried doing this with a regular HTTPS function?

- Sam

On Sat, Apr 27, 2019 at 8:09 AM <veera.k...@gmail.com> wrote:
I have a JavaScript application which compiles a JSON object and sends it to my Firebase cloud function. This function will process the JSON object and creates an XML file and will send this XML file back to browser as a 'downloadable' file.

In Express.js, I could do this with the help of `response.download` [https://expressjs.com/en/api.html#res.download] function. Is there something similar exist in Firebase functions? Please note, my functions are callable function (not the HTTP ones).

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/d2d4832c-d2d4-4d5b-ab6f-c2352ad51736%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages