1
votes

I have a collection in firebase which looks something like this:

people: 
 -KuM2GgA5JdH0Inem6lGaddclose
   appliedTo: "-KuM1IB5TisBtc34y2Bb"
   document: "docs/837c2500-9cbe-11e7-8ac1-17a6c37e2057"
   name: "Test Testerson"

the document node contains a path to a file in a storage bucket. Is it possible to download this file to the client using an http firebase function. According to Stream files in node/express to client I should be able to stream to response in express. Will the google-storage readstream work for this?

Thanks,

Ben

1

1 Answers

2
votes

The Firebase Admin SDK has a Storage object you can use. It gives you an entry point into the Google Cloud Storage SDK which can interact with storage buckets.

const bucket = admin.storage().bucket

Use this Bucket object to upload and download files. You should be able to use a stream to send contents to the client.