2

From Firebase Storage DOCS:

Trigger a function on Cloud Storage changes

Use functions.storage to create a function that handles Cloud Storage events. Depending on whether you want to scope your function to a specific Cloud Storage bucket or use the default bucket, use one of the following:

  • functions.storage.object() to listen for object changes on the default storage bucket.

  • functions.storage.bucket('bucketName').object() to listen for object changes on a specific bucket.

QUESTION

Can I listen for changes inside a specific folder of my bucket?

Example:

//myBucket/blog-post-images/...

Only trigger for files uploaded to the blog-post-images folder?

Community
  • 1
  • 1
cbdeveloper
  • 27,898
  • 37
  • 155
  • 336
  • 1
    I don't think this is possible. Have a look at this answer from Doug Stevenson (Firebase team) which explains that "there are not actually any "folders" in Cloud Storage. There are just object names that look like they contain folders." https://stackoverflow.com/a/56179173/3371862 – Renaud Tarnec Jun 28 '19 at 11:04
  • Makes sense! It's probably not possible. Thanks – cbdeveloper Jun 28 '19 at 11:07
  • 2
    PS: note that you could deduce the folder from the object name, see https://firebase.google.com/docs/storage/extend-with-functions#access_storage_object_attributes – Renaud Tarnec Jun 28 '19 at 11:13
  • 1
    Thanks! I think I'll have to do that. – cbdeveloper Jun 28 '19 at 11:13

0 Answers0