npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

owmjs

v0.1.2

Published

A small Nodejs wrapper for some OpenWeatherMap APIs

Downloads

3

Readme

Build Status Coverage Status Known Vulnerabilities

owmjs

A small Nodejs wrapper for some OpenWeatherMap APIs. For more information about the OpenWeatherMap and their APIs, please visit the OpenWeatherMap.

Installation

npm i owmjs --save

Covered OpenWeatherMap APIs

Usage

const owmjs  = require('owmjs');

// once imported you need to create the owmjs instance
const owmjsInstance = new owmjs("OpenWeatherMap apiKey", "unit format");

Current weather data

To use the current weather module use

owmjsInstance.current

ByCityName

| Parameter | Type | Description | | --- | --- | --- | | name | String | e.g. Cologne, London, New York, Tokyo | | country | String | optional; ISO 3166 country codes. e.g. uk |

Example:

owmjsInstance.current.ByCityName("Cologne").then(function (data) {
    // do stuff here
}).catch(function (err) {
    // handle error
});

ByCityID

| Parameter | Type | Description | | --- | --- | --- | | id | Number | visit http://bulk.openweathermap.org/sample/ for all city ids |

Example:

owmjsInstance.current.ByCityID(2172797).then(function (data) {
    // do stuff here
}).catch(function (err) {
    // handle error
});

ByGeographicCoordinates

| Parameter | Type | Description | | --- | --- | --- | | lat | Number | latitude | | lon | Number | longitude |

Example:

owmjsInstance.current.ByGeographicCoordinates(35, 139).then(function (data) {
    // do stuff here
}).catch(function (err) {
    // handle error
});

ByZipCode

| Parameter | Type | Description | | --- | --- | --- | | zip | Number | | | country | String | optional; ISO 3166 country codes. e.g. uk |

Example:

owmjsInstance.current.ByZipCode(94040).then(function (data) {
    // do stuff here
}).catch(function (err) {
    // handle error
});

ByRectangleZone

| Parameter | Type | Description | | --- | --- | --- | | lonleft | Number | longitude Left | | latbottom | Number | latitude Bottom | | lonright | Number | longitude Right | | lattop | Number | latitude Top | | zoom | Number | | | cluster | String | optional |

Example:

owmjsInstance.current.ByRectangleZone(12,32,15,37,10).then(function (data) {
    // do stuff here
}).catch(function (err) {
    // handle error
});

ByCircle

| Parameter | Type | Description | | --- | --- | --- | | lat | Number | latitude | | long | Number | longitude | | cnt | Number | optional | | cluster | String | optional |

Example:

owmjsInstance.current.ByCircle(55.5, 37.5).then(function (data) {
    // do stuff here
}).catch(function (err) {
    // handle error
});

MultipleCity

| Parameter | Type | Description | | --- | --- | --- | | cities | Number[] | list of city ids |

Example:

owmjsInstance.current.MultipleCity([524901,703448,2643743]).then(function (data) {
    // do stuff here
}).catch(function (err) {
    // handle error
});

forecast

To use the forecast module use

owmjsInstance.forecast

ByCityName

| Parameter | Type | Description | | --- | --- | --- | | name | String | e.g. Cologne, London, New York, Tokyo | | country | String | optional; ISO 3166 country codes. e.g. uk | | cnt | Number | optional; Number of days |

Example:

owmjsInstance.forecast.ByCityName('London', 'uk', 2).then(function (data) {
    // do stuff here
}).catch(function (err) {
    // handle error
});

ByCityID

| Parameter | Type | Description | | --- | --- | --- | | id | Number | visit http://bulk.openweathermap.org/sample/ for all city ids | | cnt | Number | optional; Number of days |

Example:

owmjsInstance.forecast.ByCityID(2172797, 2).then(function (data) {
    // do stuff here
}).catch(function (err) {
    // handle error
});

ByGeographicCoordinates

| Parameter | Type | Description | | --- | --- | --- | | lat | Number | latitude | | lon | Number | longitude | | cnt | Number | optional; Number of days |

Example:

owmjsInstance.forecast.ByGeographicCoordinates(35, 139, 2).then(function (data) {
    // do stuff here
}).catch(function (err) {
    // handle error
});

ByZipCode

| Parameter | Type | Description | | --- | --- | --- | | zip | Number | | | country | String | optional; ISO 3166 country codes. e.g. uk | | cnt | Number | optional; Number of days |

Example:

owmjsInstance.forecast.ByZipCode(94040, 'us', 2).then(function (data) {
    // do stuff here
}).catch(function (err) {
    // handle error
});

UV Index

To use the UV Index module use

owmjsInstance.uv

CurrentByGeographicCoordinates

Gives the current UV Index of the given Geographic Coordinates back

| Parameter | Type | Description | | --- | --- | --- | | lat | Number | latitude | | lon | Number | longitude |

Example:

owmjsInstance.uv.CurrentByGeographicCoordinates(37.75, -122.37).then(function (data) {
    // do stuff here
}).catch(function (err) {
    // handle error
});

ForecastByGeographicCoordinates

Gives UV Index forecast of the given Geographic Coordinates back

| Parameter | Type | Description | | --- | --- | --- | | lat | Number | latitude | | lon | Number | longitude | | cnt | Number | optional; Number of days |

Example:

owmjsInstance.uv.ForecastByGeographicCoordinates(37.75, -122.37, 2).then(function (data) {
    // do stuff here
}).catch(function (err) {
    // handle error
});

HistoricleByGeographicCoordinates

Gives historcle UV Index date of the given Geographic Coordinates back

| Parameter | Type | Description | | --- | --- | --- | | lat | Number | latitude | | lon | Number | longitude | | start | Number | start point as Unix Time | | end | Number | end point as Unix Time | | cnt | Number | optional; Number of days |

Example:

owmjsInstance.uv.HistoricleByGeographicCoordinates(37.75, -122.37, 1498049953, 1498481991, 2).then(function (data) {
    // do stuff here
}).catch(function (err) {
    // handle error
});

More information related to the OpenWeatherMap APIs can be seen here