All Projects → soplakanets → Node Forecastio

soplakanets / Node Forecastio

Licence: mit
A node.js client for Forecast.io API

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Node Forecastio

mpxday
mpxday是基于mpx开发的天气预报微信小程序
Stars: ✭ 3 (-90.62%)
Mutual labels:  weather, forecast
temps-lite
A smart, good-looking little app which tries to speak your language the way you are used to.
Stars: ✭ 40 (+25%)
Mutual labels:  weather, forecast
MMM-forecast-io
Forecast.io Module for MagicMirror
Stars: ✭ 58 (+81.25%)
Mutual labels:  weather, forecast
Getme
CLI utility for everyday tasks. With getme you get weather, forecast, currency rate, upload files, IP address, word definitions, text translations, internet speed, do google searches, get inspirational quotes and get Chuck Norris jokes
Stars: ✭ 118 (+268.75%)
Mutual labels:  forecast, weather
weather-milliseconds
Experiment to render a forecast as fast as possible
Stars: ✭ 24 (-25%)
Mutual labels:  weather, forecast
Forecastr
A simple, asynchronous Objective-C wrapper for the Forecast.io API
Stars: ✭ 143 (+346.88%)
Mutual labels:  forecast, weather
solar-weather
React Native Weather App w. Realm, Redux, ReasonReact & Forecast.io
Stars: ✭ 13 (-59.37%)
Mutual labels:  weather, forecast
Weacast
Weacast demo application
Stars: ✭ 55 (+71.88%)
Mutual labels:  forecast, weather
Jupiter
🌞 The Swift Weather Framework
Stars: ✭ 14 (-56.25%)
Mutual labels:  weather, forecast
File-Maker
Generate data files for Wii Channels that have the latest news, forecast data, etc.
Stars: ✭ 65 (+103.13%)
Mutual labels:  weather, forecast
Darkskylib
Python wrapper for the Dark Sky API
Stars: ✭ 112 (+250%)
Mutual labels:  forecast, weather
Temps
Simple menubar application based on Electron with actual weather information and forecast.
Stars: ✭ 553 (+1628.13%)
Mutual labels:  forecast, weather
Darksky
Python API wrapper for the DarkSky (async&sync)
Stars: ✭ 81 (+153.13%)
Mutual labels:  forecast, weather
Good Weather
Open source weather app for Andorid
Stars: ✭ 198 (+518.75%)
Mutual labels:  forecast, weather
Dark Sky Api
PHP Library for the Dark Sky API.
Stars: ✭ 70 (+118.75%)
Mutual labels:  forecast, weather
Weather
Weather Android App using apixu API https://www.apixu.com
Stars: ✭ 48 (+50%)
Mutual labels:  weather, forecast
Weather
A module for obtaining weather information
Stars: ✭ 54 (+68.75%)
Mutual labels:  forecast, weather
darksky
Forecast.io API wrapper in Go (Golang)
Stars: ✭ 74 (+131.25%)
Mutual labels:  weather, forecast
darksky2influxdb
Stores wheather forcecast data from darkskyapi into a influxdb database
Stars: ✭ 21 (-34.37%)
Mutual labels:  weather, forecast
Wego
weather app for the terminal
Stars: ✭ 6,918 (+21518.75%)
Mutual labels:  forecast, weather

forecastio

Build Status Dependency Status Badge

A node.js client library for Forecast.io API.

For explanation and more detailed info about endpoints and response format see Forecast.IO API documentation

Installation

npm install forecastio

Usage

Say you need a forecast for London, UK:

var ForecastIo = require('forecastio');

var forecastIo = new ForecastIo('<apiKey>');
forecastIo.forecast('51.506', '-0.127').then(function(data) {
  console.log(JSON.stringify(data, null, 2));
});

"Time Machine" Requests

Forecast.io also supports Time Machine requests. Quoting official documentation you can make request for "60 years in the past to 10 years in the future" for "many places". Example:

// What was the weather like in London on January 1st 2008?
forecastIo.timeMachine('51.506', '-0.127', '2008-01-01T00:00:01Z').then(function(data) {
  console.log(JSON.stringify(data, null, 2));
});

API Options

Both #forecast() and #timeMachine() methods support passing additional options. Below are some examples, for all options consult Options section of Forecast.IO API documentation.

Example of requesting ad forecast in Si(metric) units with only 'daily' fields:

var options = {
  units: 'si',
  exclude: 'currently,hourly,flags'
};
forecastIo.forecast('49.844', '24.028', options).then(function(data) {
  console.log(JSON.stringify(data, null, 2));
});

Another example, a "Time Machine" request in UK units and localized in Italian:

var options = {
  units: 'uk',
  lang:  'it'
};
forecastIo.timeMachine('49.844', '24.028', '2008-01-01T00:00:01Z', options).then(function(data) {
  console.log(JSON.stringify(data, null, 2));
});

Request Timeout

To set timeout for requests pass a timeout option to constructor, example:

var forecastIo = new ForecastIo('<apiKey>', {timeout: 30*1000});

As a result all API request made with with this forecastIo instance will have a timeout of 30 seconds.

Timeout option accepts time in milliseconds. If request will not finish in time - a callback will be fired with a timeout error.

TODO

  • Logging (for debugging at least)
  • Smarter API methods (accept Date object in #timeMachine() and convert it to string, for example)

Contributing

  • Fork the repo & commit changes

  • Make sure tests are not failing:

    $ env FORECASTIO_API_KEY=your_api_key npm test

  • Create a pull request

Changelog

2.0.0

  • Dropped support for node < 4.x
  • Fixed deprecation warnings for dependencies.

1.0.2

  • Fixed deprecation warnings.

1.0.0

  • Promises (For compatibility callbacks are still supported).

0.2.0

  • Added timeout option

0.1.2

  • More informative error messages.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].