Home:ALL Converter>Get siblings of created file in firebase cloud function triggered by onFinalize

Get siblings of created file in firebase cloud function triggered by onFinalize

Ask Time:2020-02-01T02:34:08         Author:Madcap

Json Formatter

I have a cloud function that triggers when new file is created in firebase storage. Inside this function logic I need to collect every other file located at the same path in array. But I don't know how.

exports.testCloudFunc = functions.storage.object().onFinalize(async object => {
  const filePath = object.name;

  const { Logging } = require('@google-cloud/logging');

  console.log(`Logged: ${filePath}`);
  let obj = JSON.stringify(object);
  console.log(`Logged: ${obj}`);
});

After that I will try to merge all PDFs in one new file and save it back to firebase storage by the same path. Any help is highly appretiated! Thank you in advance for your wisdom )

Author:Madcap,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/60009474/get-siblings-of-created-file-in-firebase-cloud-function-triggered-by-onfinalize
yy