
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
forecast.io-dschumann
Advanced tools
A simple wrapper for the awesome forecast.io API: https://developer.forecast.io/docs/v2
How to use it:
Require forecast.io
var Forecast = require('forecast.io');
Instantiate an instance of Forecast. You'll need to provide options specifying your forecast.io API Key. You may also add a timeout
option, which defaults to 2500 if not provided.
var options = {
APIKey: process.env.FORECAST_API_KEY,
timeout: 1000
},
forecast = new Forecast(options);
Make a call to the API using the get or getAtTime methods.
The get function calls to the https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE endpoint.
forecast.get(latitude, longitude, function (err, res, data) {
if (err) throw err;
log('res: ' + util.inspect(res));
log('data: ' + util.inspect(data));
});
getAtTime calls the similar endpoint with time specified: https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE,TIME.
var time = new Date().setDate(0); // lets use an arbitrary date
forecast.getAtTime(latitude, longitude, time, function (err, res, data) {
if (err) throw err;
log('res: ' + util.inspect(res));
log('data: ' + util.inspect(data));
});
Additional:
Both get and getAtTime functions accept optional parameters to accommodate the optional query string params available for the forecast API calls. The following call is, for instance, possible and will return only the current property and its child properties:
var options = {
exclude: 'minutely,hourly,daily,flags,alerts'
};
forecast.get(latitude, longitude, options, function (err, res, data) {
if (err) throw err;
log('res: ' + util.inspect(res));
log('data: ' + util.inspect(data));
});
FAQs
wrapper around forecast.io weather API
The npm package forecast.io-dschumann receives a total of 4 weekly downloads. As such, forecast.io-dschumann popularity was classified as not popular.
We found that forecast.io-dschumann demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.