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

@withaspark/weather

v2.0.3

Published

Current weather and forecast fetching script

Readme

Weather

Current weather and forecast fetching script

Install

NPM

npm install --save @withaspark/weather

Usage

Script

var Weather = require('path/to/src/withaspark.weather.js')({ station: "KJAX", cache_lifetime: 10 });

console.log(Weather.getTemperature());
// 62

console.log(Weather.getSunrise());
// "2019-04-28T06:47:22.419-04:00"

console.log(Weather.get());
// { station: 'KJAX',
//   sunrise: '2019-04-28T06:47:22.419-04:00',
//   sunset: '2019-04-28T20:03:36.240-04:00',
//   timestamp: '2019-04-28T03:56:00+00:00',
//   raw: 'KJAX 280356Z 00000KT 10SM CLR 17/12 A3003 RMK AO2 SLP169 T01720122 $',
//   coordinates: [ 30.5, -81.7 ],
//   elevation: 29,
//   text: 'Clear',
//   temperature: 62,
//   dewpoint: 53,
//   windDirection: 0,
//   windSpeed: 0,
//   pressure: 762,
//   visibility: 9,
//   precipitation: 0,
//   humidity: 72,
//   feelsLike: 32,
//   alerts: '',
//   sunIcon: \uf02e,
//   conditionIcon: \uf02e,
//   isDay: 0,
//   isNight: 1,
//   isSunrise: 0,
//   isSunset: 0 }

Commandline

path/to/src/withaspark.weather.cli.js --station=KJAX temperature
# 68

path/to/src/withaspark.weather.cli.js --station=KJAX sunrise
# "2019-04-28T06:47:22.419-04:00"

path/to/src/withaspark.weather.cli.js --station=KJAX
# { station: 'KJAX',
#   sunrise: '2019-04-28T06:47:22.419-04:00',
#   sunset: '2019-04-28T20:03:36.240-04:00',
#   timestamp: '2019-04-28T02:58:00+00:00',
#   raw: 'KJAX 280056Z 15007KT 10SM FEW250 20/11 A2999 RMK AO2 SLP156 T02000111 $',
#   coordinates: '30.5,-81.7',
#   elevation: 30,
#   text: 'Mostly Clear',
#   temperature: 68,
#   dewpoint: 52,
#   windDirection: 150,
#   windSpeed: 0,
#   pressure: 762,
#   visibility: 10,
#   precipitation: 0,
#   humidity: 57,
#   feelsLike: 32,
#   alerts: '',
#   sunIcon: \uf02e,
#   conditionIcon: \uf02e,
#   isDay: 0,
#   isNight: 1,
#   isSunrise: 0,
#   isSunset: 0 }

Options

| Option | Default | Description | |---|---|---| | station | "KJAX" | Local weather station to find weather for. Choose nearest station from https://www.aviationweather.gov/docs/metar/stations.txt. | | cache_dir | "/tmp" | Directory to write cache files too. | | cache_prefix | "withaspark.weather." | Prefix for cache file names. | | cache_lifetime | 5 | Number of minutes to cache results before refetching. | | user_agent | "@withaspark/weather User" | User agent to use when making requests to weather API. If experiencing rate-limiting issues, set to something unique. | | unknown | "?" | Symbol for unknown value. |

Properties

| Property | Method | Description | |---|---|---| | station | getStation() | Get the weather station data was requested for. E.g., "KJAX". | | sunrise | getSunrise() | Get the ISO-8601 formatted time of sunrise for the station. E.g., "2019-04-28T06:47:22.419-04:00". | | sunset | getSunset() | Get the ISO-8601 formatted time of sunset for the station. E.g., "2019-04-28T20:03:36.240-04:00". | | timestamp | getTimestamp() | Get the timestamp of when the weather data was last fetched. E.g., "2019-04-28T01:58:00+00:00". | | raw | getRaw() | Get the raw METAR data for the station. | | coordinates | getCoordinates() | Get the approximate longitude and latitude for the station. | | elevation | getElevation() | Get the approximate elevation for the station, in feet. | | text | getText() | Get the brief textual description of current conditions at the station. | | temperature | getTemperature() | Get the current temperature at the station, in Fahrenheit. | | dewpoint | getDewpoint() | Get the current dewpoint temperature at the station, in Fahrenheit. | | windDirection | GetWindDirection() | Get the current wind direction at the station, in degrees. | | windSpeed | getWindSpeed() | Get the current wind speed at the station, in mph. | | pressure | getPressure() | Get the current barometric pressure at the station, in mmHg. | | visibility | getVisibility() | Get the current ground-level visibility at the station, in miles. | | precipitation | getPrecipitation() | Get the amount of precipitation in the last hour at the station, in inches. | | humidity | getHumidity() | Get the current relative humidity at the station, in percent. | | feelsLike | getFeelsLike() | Get the current feels-like temperature at the station, in degrees Fahrenheit. | | alerts | getAlerts() | Get the current weather advisory types at the station. This will contain a newline delimited list of advisory types. | | sunIcon | getSunIcon() | Get the unicode character that represents the sun position. To be used with the font Weather Icons by @erikflowers. | | conditionIcon | getConditionIcon() | Get the unicode character that represents the weather conditions. If it is currently clear with no conditions of note, it will return an empty string. To be used with the font Weather Icons by @erikflowers. | | isDay | getIsDay() | Get if the sun is currently up at the station. Returns integer value (value of 1 means sun is up). | | isNight | getIsNight() | Get if the sun is currently down at the station. Returns integer value (value of 1 means sun is down). | | isSunrise | getIsSunrise() | Get if the sun is currently rising at the station. Returns integer value (value of 1 means the sun is rising). | | isSunset | getIsSunset() | Get if the sun is currently setting at the station. Returns integer value (value of 1 means the sun is setting). |