eesti-hetkeilm
v1.0.0
Published
Eesti riiklike ilmajaamade hetkeandmed.
Downloads
2
Readme
Description:
A simple module to retrieve current weather data from http://www.ilmateenistus.ee/ilma_andmed/xml/observations.php. Data outputs to javascript object.
Installation:
$ npm i eesti-hetkeilm
Usage:
eesti-hetkeilm(location, options, callback)
location
(string) :required
options
(object) :optional
callback
(function) :required
Returns either JavaScript object or error (error-first callback).
Options:
strict
(default:false
): Restricts request to exact search string. E.g "Tallinn" does not match "Tallinn-Harku".
Usage example 1:
const ilm = require("eesti-hetkeilm");
ilm("tallinn", function(err, data) {
if (err) {
console.log(err); // null
} else {
console.log(data.airtemperature); // 22
}
});
Usage example 2:
const ilm = require("eesti-hetkeilm");
ilm("tallinn", { strict: true }, function(err, data) {
if (err) {
console.log(err); // Location not found.
} else {
console.log(data.airtemperature); // null
}
});