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

openweathermap-node

v1.2.0

Published

An OpenWeatherMap Wrapper For Node.js

Downloads

155

Readme

OpenWeatherMap-Node

An Openweathermap wrapper for nodejs

You need an API Key to use the OpenWeatherMap API. Head on over to their website if you don't already have one.

Installation

npm install openweathermap-node

Usage

Instantiate the OpenWeatherMapHelper class

const OpenWeatherMapHelper = require("openweathermap-node");

Set your API Key (Required)

const helper = new OpenWeatherMapHelper(
	{
		APPID: 'YOUR_OPENWEATHERMAP_API_KEY_GOES_HERE',
		units: "imperial",
		lang: "en"
	}
);
Unit Options(Optional, Kelvin by default) :
  1. imperial

  2. metric

Language Options(Optional, English by default) :

Code | Language ------------ | ------------- af | Afrikaans al | Albanian ar | Arabic az | Azerbaijani bg | Bulgarian ca | Catalan cz | Czech da | Danish de | German el | Greek en | English eu | Basque fa | Persian (Farsi) fi | Finnish fr | French gl | Galician he | Hebrew hi | Hindi hr | Croatian hu | Hungarian id | Indonesian it | Italian ja | Japanese kr | Korean la | Latvian lt | Lithuanian mk | Macedonian no | Norwegian nl | Dutch pl | Polish pt | Portuguese pt_br | Português Brasil ro | Romanian ru | Russian sv, se | Swedish sk | Slovak sl | Slovenian sp, es | Spanish sr | Serbian th | Thai tr | Turkish ua, uk | Ukrainian vi | Vietnamese zh_cn | Chinese Simplified zh_tw | Chinese Traditional zu | Zulu

Features

(1) Current Weather

Get current weather by City Name:

helper.getCurrentWeatherByCityName("Accra", (err, currentWeather) => {
	if(err){
		console.log(err);
	}
	else{
		console.log(currentWeather);
	}
});

Get current weather by City ID:

helper.getCurrentWeatherByCityID("524901", (err, currentWeather) => {
	if(err){
		console.log(err);
	}
	else{
		console.log(currentWeather);
	}
});

Get current weather by Geographic Coordinates:

helper.getCurrentWeatherByGeoCoordinates(5.6037, 0.1870, (err, currentWeather) => {
	if(err){
		console.log(err);
	}
	else{
		console.log(currentWeather);
	}
});

Get current weather by Zip Code:

helper.getCurrentWeatherByZipCode("90003", (err, currentWeather) => {
	if(err){
		console.log(err);
	}
	else{
		console.log(currentWeather);
	}
});

(2) 5 day / 3 hour forecast

Get three hour forecast by City Name:

helper.getThreeHourForecastByCityName("Pretoria", (err, threeHourForecast) => {
	if(err){
		console.log(err);
	}
	else{
		console.log(threeHourForecast);
	}
});

Get three hour forecast by City ID:

helper.getThreeHourForecastByCityID("524901", (err, threeHourForecast) => {
	if(err){
		console.log(err);
	}
	else{
		console.log(threeHourForecast);
	}
});

Get three hour forecast by Geographic Coordinates:

helper.getThreeHourForecastByGeoCoordinates(6.5244,3.3792, (err, threeHourForecast) => {
	if(err){
		console.log(err);
	}
	else{
		console.log(threeHourForecast);
	}
});

Get three hour forecast by Zip Code:

helper.getThreeHourForecastByZipCode("94040", (err, threeHourForecast) => {
	if(err){
		console.log(err);
	}
	else{
		console.log(threeHourForecast);
	}
});

Upcoming Feature

  1. 16 day / daily forecast