weather-msn
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

A package to retrieve weather information for a specified location.

Example / usage :

/** If ESM */
import getWeather from "weather";
                or
import { getWeather } from "weather";

/** If CJS */
const { getWeather } = require("weather");

const location = "Singapore"; // can be any location name or zip code

const weatherData = await getWeather(location);
  .catch((error) => {
    console.log(error);
    return undefined;
  });

  if (!weatherData) return;

  . . . // do something with the weather data
// output from the above code

{
  humidity: '90',
  feelslike: '29',
  temperature: '26',
  location: 'Singapore',
  wind: '5 km/h Southeast',
  weather: 'Mostly cloudy',
  image: 'http://blob.weather.microsoft.com/static/weather4/en-us/law/27.gif'
}

Throws error if :

• WeatherData for the location is not found.
• MSN weather service does not return any valid results.
• Location is not specified or location name is too long ( > 50 ).

For support / query :

1. Join our discord https://codes-for.fun

2. Send me an email mailto:support@codes-for.fun

Package Sidebar

Install

npm i weather-msn

Weekly Downloads

4

Version

1.0.0

License

MIT

Unpacked Size

3.56 kB

Total Files

4

Last publish

Collaborators

  • painfuego