Socket
Socket
Sign inDemoInstall

weather-api-client

Package Overview
Dependencies
8
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    weather-api-client

Library for calling weatherapi.com


Version published
Weekly downloads
4
Maintainers
1
Install size
1.03 MB
Created
Weekly downloads
 

Readme

Source

node-weatherapi

Simple weatherapi.com library for nodejs

To use, get a free API key here.

Usage

To install

npm i weather-api-client

To use

const Weather = require('weather-api-client');

const weather = new Weather(API_KEY);

// Get current weather data
weather.getCurrent('Emporia, KS').then(result => {
  console.log(result);
});

// Get weather forecast for the next 5 days
weather.getCurrent('Emporia, KS', 5).then(result => {
  console.log(result);
});

Example response:

{
    "location": {
        "name": "Emporia",
        "region": "Kansas",
        "country": "United States of America",
        "lat": 38.4,
        "lon": -96.18,
        "tz_id": "America/Chicago",
        "localtime_epoch": 1640520857,
        "localtime": "2021-12-26 6:14"
    },
    "current": {
        "last_updated_epoch": 1640516400,
        "last_updated": "2021-12-26 05:00",
        "temp_c": 2.2,
        "temp_f": 36.0,
        "is_day": 0,
        "condition": {
            "text": "Clear",
            "icon": "//cdn.weatherapi.com/weather/64x64/night/113.png",
            "code": 1000
        },
        "wind_mph": 6.9,
        "wind_kph": 11.2,
        "wind_degree": 110,
        "wind_dir": "ESE",
        "pressure_mb": 1011.0,
        "pressure_in": 29.86,
        "precip_mm": 0.0,
        "precip_in": 0.0,
        "humidity": 89,
        "cloud": 0,
        "feelslike_c": -1.4,
        "feelslike_f": 29.5,
        "vis_km": 13.0,
        "vis_miles": 8.0,
        "uv": 1.0,
        "gust_mph": 17.4,
        "gust_kph": 28.1
    }
}

Keywords

FAQs

Last updated on 26 Dec 2021

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc