Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

msn-weather

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

msn-weather

A simple MSN Weather API wrapper with built-in TypeScript support.

  • 2.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Logo

MSN Weather API

A simple MSN Weather API wrapper with built-in TypeScript support.

Travis CI Codecov Code Climate NPM downloads Size License

NPM install info

Table of contents

About

msn-weather is a powerful Node.js library that allows you to easily retrieve weather data for any location in the world. As the name suggests, this wrapper uses the MSN weather API behind the scenes.

  • Simple and easy-to-use API
  • Built-in TypeScript definitions
  • Only one dependency
  • Clear weather data format
  • Performant

Installation

Install this package using NPM:

npm install msn-weather --save

Usage

import weather from "msn-weather";

const data = await weather.search({
  location: "Munich, DE",
  language: "en",
  degreeType: "C"
});

Usage with CommonJS

To use this library with CommonJS, use this approach:

const weather = require("msn-weather").default;

Retrieved data format

You will receive a JavaScript object looking like this:

Show response
{
  current: {
    date: "2021-06-09",
    day: "Wednesday",
    temperature: "23°C",
    sky: {
      code: "partly_sunny",      
      text: "Partly Sunny"        
    },
    observation: {
      time: "12:00:00",
      point: "Munich, BY, Germany"
    },
    feelsLike: "22°C",
    humidity: "58%",
    wind: {
      display: "7 km/h North",    
      speed: "7 km/h"
    }
  },
  forecasts: [
    {
      date: "2021-06-09",
      day: "Wednesday",
      temperature: {
        low: "14°C",
        high: "24°C"
      },
      sky: {
        code: "partly_sunny",
        text: "Partly Sunny"
      },
      precip: "90%"
    },
    {
      date: "2021-06-10",
      day: "Thursday",
      temperature: {
        low: "13°C",
        high: "22°C"
      },
      sky: {
        code: "light_rain",
        text: "Light Rain"
      },
      precip: "100%"
    },
    {
      date: "2021-06-11",
      day: "Friday",
      temperature: {
        low: "15°C",
        high: "23°C"
      },
      sky: {
        code: "light_rain",
        text: "Light Rain"
      },
      precip: "100%"
    },
    {
      date: "2021-06-12",
      day: "Saturday",
      temperature: {
        low: "15°C",
        high: "24°C"
      },
      sky: {
        code: "light_rain",
        text: "Light Rain"
      },
      precip: "100%"
    }
  ]
}

API documentation

weather.search(options)

Retrieves weather data for a given location. Returns a promise with weather data (see retrieved data format).

ParameterTypeOptionalDefaultDescription
optionsOptionsNoneOptions for the search.
Options

Options for the search.

ParameterTypeOptionalDefaultDescription
locationStringNoneLocation for the weather data. The location will be encoded automatically using encodeURIComponent.
languageStringenLanguage in which weather text will be returned. The value must be a ISO 639.1:2002 language code.
degreeTypeStringCDegree type for temperature values. Either Celsius (C) or Fahrenheit (F).

Resources

Acknowledgements

Contributors

A special thanks goes out to these contributors:

  • Khang (khang-nd) - Contributing a number of times

License

This project is licensed under MIT.

Keywords

FAQs

Package last updated on 04 Jun 2022

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

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc