Skip to content

Instantly share code, notes, and snippets.

@teeler
Forked from kconragan/gist:2402730
Created April 17, 2012 02:28
Show Gist options
  • Save teeler/2403012 to your computer and use it in GitHub Desktop.
Save teeler/2403012 to your computer and use it in GitHub Desktop.
var moment = require('moment');
var request = require('request');
exports.formatDate = function(format, date) {
};
// Takes NDBC Buoy ID, and returns
// series of readings
var fetchBuoy = function(buoyId) {
request('http://www.ndbc.noaa.gov/data/5day2/' + buoyId + '_5day.txt', function(err, response, body){
if(err || response.statusCode !== 200) {
return -1;
}
console.log(body); // this works
return body; // this returns undefined
})
};
exports.parseBuoyData = function(buoy) {
var buoys = fetchBuoy(buoy);
console.log(buoys);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment