0.4.1 • Published 8 years ago

maybe-json v0.4.1

Weekly downloads
1
License
MIT
Repository
-
Last release
8 years ago

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 drpaulbrewer@eaftc.com

License

MIT

0.4.1

8 years ago

0.4.0

8 years ago

0.3.3

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago