@squawk
    Preparing search index...
    • Fetches PIREPs from the Aviation Weather Center text API and parses each record. AWC returns one PIREP per line for the pirep endpoint.

      The PIREP endpoint is station-centric: results are filtered to reports near the given center-point airport. The AWC API accepts a single id only (no comma-separated list), so this function takes a single station identifier. The identifier must be a 4-letter ICAO code (e.g. KDEN, not DEN); AWC returns a 400 Invalid location specified for shorter forms.

      import { fetchPirep } from '@squawk/weather/fetch';

      const { pireps } = await fetchPirep('KDEN', { distance: 100, age: 6 });
      console.log(pireps[0]?.aircraftType);

      Parameters

      • id: string

        A 4-letter ICAO station identifier used as the search center.

      • options: FetchPirepOptions = {}

        Optional filter parameters, abort signal, and base URL override.

      Returns Promise<FetchPirepResult>

      The parsed PIREPs, any per-record parse errors, and the raw body.