Skip to content

Instantly share code, notes, and snippets.

@harrisonhjones
Forked from ahmedsa1983/Get event data
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harrisonhjones/8dcc4788ec49f8dca0f1 to your computer and use it in GitHub Desktop.
Save harrisonhjones/8dcc4788ec49f8dca0f1 to your computer and use it in GitHub Desktop.
/*jslint node: true */
"use strict";
// Setup the modules we need to use
var spark = require('spark');
var fs = require('fs');
// Login and start doing things!
spark.on('login', function() {
//Get test event for specific core
spark.getEventStream('My Event Name', 'My Core ID', function(data) {
console.log("New Event: " + JSON.stringify(data) + ". Logging it to file");
fs.appendFile('myAwesomeLog.txt', data.data + "\n", function (err) {
if(err)
console.log("File log failure. Error = " + JSON.stringify(err));
else
console.log("File log success");
});
});
});
// Login as usual
spark.login({ username: 'Myemail@gmail.com', password: 'MyPassword'});
//spark.login({ accessToken: '012345' });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment