{"library":"openweather-api-node","title":"OpenWeather API Node.js Client","description":"openweather-api-node is a lightweight JavaScript/TypeScript wrapper that simplifies interaction with various OpenWeather API endpoints, including Current Weather, Forecast, OneCall (version 3.0), Geocoding, Historical data, and Air Pollution data. Currently at version 3.1.5, it provides a stable and actively maintained interface for integrating weather data into Node.js applications. The package has undergone significant refactoring, including a full TypeScript rewrite in v2.0.0 and the removal of Axios in v3.1.0, making it more self-contained. While there isn't a strict release schedule, the library sees regular updates for new API features and improvements. Its primary differentiator is its comprehensive support for multiple OpenWeather APIs and full TypeScript typings out-of-the-box.","language":"javascript","status":"active","last_verified":"Tue Apr 21","install":{"commands":["npm install openweather-api-node"],"cli":null},"imports":["import OpenWeatherAPI from 'openweather-api-node'","const { OpenWeatherAPI } = require('openweather-api-node')","import type { OpenWeatherAPI_Options } from 'openweather-api-node'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import OpenWeatherAPI from \"openweather-api-node\";\n\nconst weather = new OpenWeatherAPI({\n    key: process.env.OPENWEATHER_API_KEY ?? '', // Ensure your API key is set as an environment variable\n    locationName: \"New York\",\n    units: \"imperial\"\n});\n\nweather.getCurrent().then(data => {\n    console.log(`Current temperature in New York is: ${data.weather.temp.cur}\\u00B0F`);\n}).catch(error => {\n    console.error(\"Failed to fetch current weather:\", error.message);\n});\n\nweather.getForecast().then(data => {\n    console.log(`Forecast for New York (first entry): ${data.weather[0].temp.day}\\u00B0F`);\n}).catch(error => {\n    console.error(\"Failed to fetch forecast:\", error.message);\n});","lang":"typescript","description":"Demonstrates initializing the OpenWeatherAPI client with an API key and location, then fetching current weather and forecast data.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}