https://github.com/drpaulbrewer/maybe-json
Google Cloud Function helper to log and transform bucket events to Promises of new json file metadata and json data
https://github.com/drpaulbrewer/maybe-json
google-cloud-functions json-files monitor-bucket
Last synced: 10 months ago
JSON representation
Google Cloud Function helper to log and transform bucket events to Promises of new json file metadata and json data
- Host: GitHub
- URL: https://github.com/drpaulbrewer/maybe-json
- Owner: DrPaulBrewer
- License: other
- Created: 2017-03-26T01:22:26.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2025-03-10T07:01:05.000Z (over 1 year ago)
- Last Synced: 2025-03-10T08:21:36.366Z (over 1 year ago)
- Topics: google-cloud-functions, json-files, monitor-bucket
- Language: JavaScript
- Size: 15.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# maybe-json
Google Cloud Function helper to log and transform bucket events to Promises of new json file metadata and json data
This is a helper or skeleton for writing back-end events that trigger on change to a google storage bucket.
All uploaded json file contents are logged, and then returned from a new Promise, provided file size < 1 MB
## Usage
const maybejSON = require('maybe-json');
exports.myGoogleCloudFunction = function myGoogleCloudFunction(event){
return (maybeJSON(event)
.then(function(filedata){
if (filedata) { // note, filedata can be "undefined" for non-file events or deletion events
const file = filedata.file; // the google cloud function file event
const data = filedata.data; // the parsed json data contained in the new file
// do something useful with the data
}
})
);
}
### Copyright
Copyright 2017, Paul Brewer, Economic and Financial Technology Consulting LLC
### License
MIT