Wrapper for the yr.no weather service API.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

yr.no-interface

Simple request wrapper for the yr.no weather service API.

API

All functions for the API contain the same signature: yrno.func([params,] version [, callback]). params and callback are optional. If no callback is provided a stream is returned so you can use Node's stream awesomeness. params should contain the querystring params as specified at the yr.no docs.

Each request must specify the version as the API requires this.

Examples

Simple Example

var yrno = require('yr.no-interface'),
    dublin = {
        lat: 53.3478,
        lon: 6.2597
    },
    LOC_VER = 1.9;


yrno.locationforecast(dublin, LOC_VER, function (err, xml) {
    if (err) {
        // Something went wrong...
    } else {
        // We got an XML response!
    }
});

Streaming Example

var yrno = require('yr.no-interface'),
    fs = require('fs'),
    dublin = {
        lat: 53.3478,
        lon: 6.2597
    },
    LOC_VER = 1.9;


yrno.locationforecast(dublin, LOC_VER).pipe(fs.createWriteStream('./res.xml'));