Socket
Book a DemoInstallSign in
Socket

openweathermap-node

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openweathermap-node

An OpenWeatherMap Wrapper For Node.js

latest
Source
npmnpm
Version
1.2.0
Version published
Maintainers
1
Created
Source

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) :
  • imperial

  • metric

Language Options(Optional, English by default) :
CodeLanguage
afAfrikaans
alAlbanian
arArabic
azAzerbaijani
bgBulgarian
caCatalan
czCzech
daDanish
deGerman
elGreek
enEnglish
euBasque
faPersian (Farsi)
fiFinnish
frFrench
glGalician
heHebrew
hiHindi
hrCroatian
huHungarian
idIndonesian
itItalian
jaJapanese
krKorean
laLatvian
ltLithuanian
mkMacedonian
noNorwegian
nlDutch
plPolish
ptPortuguese
pt_brPortuguês Brasil
roRomanian
ruRussian
sv, seSwedish
skSlovak
slSlovenian
sp, esSpanish
srSerbian
thThai
trTurkish
ua, ukUkrainian
viVietnamese
zh_cnChinese Simplified
zh_twChinese Traditional
zuZulu

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

  • 16 day / daily forecast

Keywords

OpenWeatherMap

FAQs

Package last updated on 02 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.