JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 29
  • Score
    100M100P100Q59245F

Node.js wrapper for the yr.no weather service API.

Package Exports

  • yr.no-interface

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (yr.no-interface) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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-intrface'),
    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-intrface'),
    fs = require('fs'),
    dublin = {
        lat: 53.3478,
        lon: 6.2597
    },
    LOC_VER = 1.9;


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