April 2018
Intermediate to advanced
284 pages
6h 43m
English
With Cloud Storage Triggers, you can execute a Firebase Cloud Function in response to create, update, or delete operation of files and folders in Cloud Storage. We can create a new function for Cloud Storage events with functions.storage. Depending on the requirement, you can have a function that listens for all changes on the default storage bucket, or you can restrict it to a specific bucket by specifying the bucket name:
functions.storage.object() - listen for object changes on the default storage bucket.functions.storage.bucket('test').object() - listen for object changes on a specific bucket called 'test'
For example, we can write a function that compresses the uploaded files to reduce the size:
exports.compressFiles ...