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 🙏

© 2026 – Pkg Stats / Ryan Hefner

openweather-wrapper-api

v1.5.3

Published

A simple wrapper for the OpenWeather API to get weather information.

Readme

OpenWeather Wrapper API

A simple and easy-to-use wrapper for the OpenWeather API to fetch weather data for a given city. It allows you to get current weather information such as temperature, humidity, weather conditions, and wind speed.


Features

  • Fetch weather data for any city.
  • Retrieves information such as temperature, weather description, humidity, and wind speed.
  • Uses .env file to securely store and load the OpenWeather API key.

Install

Simply install the package with

npm i openweather-wrapper-api

Setup

1. Get your OpenWeather API Key

To use the OpenWeather API, you need an API key. You can get it for free by signing up on OpenWeather.

2. Set up the .env file

Create a .env file in the root directory of the project and add your OpenWeather API key like so:

OPENWEATHER_API_KEY=your_api_key_here

Replace your_api_key_here with the API key you obtained from OpenWeather.

Important: Make sure your .env file is not committed to version control (e.g., Git). You can add .env to your .gitignore file to prevent it from being tracked.

3. Install dependencies

Once you have the .env file set up, you need to install the necessary dependencies. Run the following command in your terminal:

npm install

This will install the axios and dotenv dependencies required to interact with the OpenWeather API and load environment variables.


Usage

After setting up your environment and installing the necessary dependencies, you can start using the package to fetch weather data.

1. Import the Package

In your JavaScript code, import the getWeatherByCity function from the package:

const { getWeatherByCity } = require('openweather-wrapper-api');

2. Get Weather Data for a City

You can now call getWeatherByCity(city) to get the weather information for a specific city. Make sure to replace "city" with the name of the city you want to look up.

Here is an example:

const { getWeatherByCity } = require('openweather-wrapper-api');

// Fetch weather data for a city
async function getWeather() {
  try {
    const weather = await getWeatherByCity('Berlin');
    console.log(`Weather in ${weather.city}:`);
    console.log(`Temperature: ${weather.temperature}°C`);
    console.log(`Weather: ${weather.weather}`);
    console.log(`Humidity: ${weather.humidity}%`);
    console.log(`Wind Speed: ${weather.windSpeed} m/s`);
  } catch (error) {
    console.error('Error fetching weather data:', error);
  }
}

getWeather();

3. Sample Output

Here is an example of the output you will receive:

Weather in Berlin:
Temperature: 15°C
Weather: Clear sky
Humidity: 50%
Wind Speed: 3.6 m/s

License

This project is licensed under the MIT License - see the LICENSE file for details.


Contributing

If you'd like to contribute to this project, feel free to open an issue. Any contributions, whether small or large, are welcome!


Thank You!

Thank you for using the OpenWeather Wrapper API! If you have any questions, feel free to open an issue or reach out.

Enjoy coding! 😊