Fetches METARs from the Aviation Weather Center text API and parses each record. Partial failures (a single malformed METAR) are surfaced via the parseErrors field rather than thrown; network-level errors and non-2xx HTTP responses throw.
parseErrors
import { fetchMetar } from '@squawk/weather/fetch';const { metars } = await fetchMetar('KJFK');console.log(metars[0]?.stationId); // "KJFK" Copy
import { fetchMetar } from '@squawk/weather/fetch';const { metars } = await fetchMetar('KJFK');console.log(metars[0]?.stationId); // "KJFK"
Multiple stations are comma-joined into a single request:
const { metars } = await fetchMetar(['KJFK', 'KLAX', 'KORD']); Copy
const { metars } = await fetchMetar(['KJFK', 'KLAX', 'KORD']);
A single ICAO station identifier or an array of identifiers.
Optional abort signal and base URL override.
The parsed METARs, any per-record parse errors, and the raw body.
Fetches METARs from the Aviation Weather Center text API and parses each record. Partial failures (a single malformed METAR) are surfaced via the
parseErrorsfield rather than thrown; network-level errors and non-2xx HTTP responses throw.Multiple stations are comma-joined into a single request: