weather.js
This a typesafe wrapper of the unnoficial MSN weather API
Instalattion
No apiKey, its free.
Dependencies
axios fast-xml-parser
To install use:
npm i @ifraan_/weather.js
You must use API.search before using any other method
search can take options parameters
await search('Location', {
degree: 'C',
lang: 'en-UK',
timeout: 5_000
})
Methods | Description |
---|
info | Generical info |
current | Current weather |
forecast | Forecast for the next 5 days |
Example code:
const { API } = require('@ifraan_/weather.js');
try {
const city = await API.search('Broklyn, NY', { degree: 'F', lang: 'en-US' })
console.log('Info: ', city.info())
console.log('Current: ', city.current())
console.log('Forecast: ', city.forecast())
} catch (err) {
console.log(err)
}
Disclaimer
This project is fully for educational purposes.