Created
February 6, 2018 02:25
-
-
Save mfurlend/279386ee87cab9403c8f6fcf9d5b9152 to your computer and use it in GitHub Desktop.
#cloud functions #trigger #cloud storage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.helloGCS = (event, callback) => { | |
const file = event.data; | |
if (file.resourceState === 'not_exists') { | |
console.log(`File ${file.name} deleted.`); | |
} else if (file.metageneration === '1') { | |
// metageneration attribute is updated on metadata changes. | |
// on create value is 1 | |
console.log(`File ${file.name} uploaded.`); | |
} else { | |
console.log(`File ${file.name} metadata updated.`); | |
} | |
callback(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment