Airport Data

raw JSON →
1.0.1 verified Thu Apr 23 auth: no javascript abandoned

The `airport-data` package provides a static JSON snapshot of airport information derived from the OpenFlights Airports Database. It offers a structured array of airport objects, each containing details such as ID, name, city, country, IATA and ICAO codes, geographical coordinates, altitude, timezone, and type. The current stable and only major version is 1.0.1, published over 8 years ago (as of 2026). This package serves as a direct, unmaintained dump of data from its time of publication, with no ongoing updates or release cadence. Its key differentiator is its simplicity as a pre-packaged JSON array, suitable for applications requiring historical or non-real-time airport data, but critically, it does not reflect any changes or additions to the global airport landscape since its last release.

error Error: Cannot find module 'airport-data'
cause The package `airport-data` is not installed or the import path is incorrect.
fix
Ensure the package is installed in your project: npm install airport-data.
error TypeError: (0 , airport_data_1.default) is not a function (when using `import airports from 'airport-data'` in an ESM context)
cause Attempting to use a CommonJS module that exports an array directly as a default ES module import, which isn't directly compatible without specific handling or a namespace import.
fix
Use import * as airports from 'airport-data' for namespace import in ESM, or stick to const airports = require('airport-data') in CommonJS environments.
gotcha The data provided by `airport-data@1.0.1` is a static snapshot published over 8 years ago (as of 2026). It is critically outdated and does not reflect new airports, closed airports, changed IATA/ICAO codes, or updated geographic/timezone information.
fix For current airport data, use actively maintained alternatives or fetch directly from up-to-date sources like the OpenFlights API or other contemporary data providers.
gotcha This package is a CommonJS module (`module.exports = require('./airports.json')`) and does not provide a native ES module entry point. This can lead to issues or require specific configurations when used in modern ESM-only environments without transpilation.
fix In an ESM context, consider using `import * as airports from 'airport-data'` or directly importing the JSON file if your build system or Node.js version supports it (`import airports from 'airport-data/airports.json'`). Ensure your build tools are configured for CJS interoperability.
npm install airport-data
yarn add airport-data
pnpm add airport-data

Demonstrates loading the static airport data and performing basic filtering and lookup operations using CommonJS `require`.

const airports = require('airport-data');

console.log(`Total airports in database: ${airports.length}`);

// Find an airport by IATA code
const yulAirport = airports.find(airport => airport.iata === 'YUL');
if (yulAirport) {
  console.log(`
Found YUL Airport:`);
  console.log(`  Name: ${yulAirport.name}`);
  console.log(`  City: ${yulAirport.city}, ${yulAirport.country}`);
  console.log(`  Coordinates: ${yulAirport.latitude}, ${yulAirport.longitude}`);
}

// Filter airports in a specific country
const canadianAirports = airports.filter(airport => airport.country === 'Canada');
console.log(`
Number of Canadian airports: ${canadianAirports.length}`);