gtfs-sqljs
    Preparing search index...

    Class GtfsSqlJs

    Index

    Methods

    • Build a directed stop-to-stop graph for the given trips.

      Edges connect consecutive stops in a trip (paired via stop_sequence, whose values need not be contiguous). Each edge carries the list of trips traversing it, with route_id and direction_id attached.

      Parameters

      • tripIds: string[]

      Returns Promise<Graph>

    • Build an ordered list of stops from multiple trips

      Parameters

      • tripIds: string[]

      Returns Promise<Stop[]>

    • Clear all realtime data from the database

      Returns Promise<void>

    • Close the database connection.

      When the library itself created the DB handle (via fromZip, fromZipData, fromDatabase, or when attach() was called with ownsDatabase: true), this also closes the underlying adapter. For handles passed to attach() without ownsDatabase, this is a no-op beyond clearing the internal reference — the caller owns the handle.

      Returns Promise<void>

    • Export database to ArrayBuffer

      Throws ExportNotSupportedError if the active adapter is file-backed and cannot serialize the database to bytes.

      Returns Promise<ArrayBuffer>

    • Fetch and load GTFS Realtime data from configured feed URLs or provided URLs

      Parameters

      • Optionalurls: string[]

      Returns Promise<void>

    • Get active service IDs for a given date (YYYYMMDD format)

      Parameters

      • date: string

      Returns Promise<string[]>

    • Get calendar entry by service_id

      Parameters

      • serviceId: string

      Returns Promise<Calendar | null>

    • Get timestamp of the last successful realtime data fetch and insertion

      Returns number | null

    • Get currently configured GTFS-RT feed URLs

      Returns string[]

    • Get current staleness threshold

      Returns number

    • Get trips with optional filters Pass tripId filter to get a specific trip

      Parameters

      Returns Promise<Trip[]>

    • Load GTFS Realtime data from pre-loaded protobuf buffers

      Parameters

      • buffers: Uint8Array<ArrayBufferLike>[]

      Returns Promise<void>

    • Set GTFS-RT feed URLs

      Parameters

      • urls: string[]

      Returns void

    • Set staleness threshold in seconds

      Parameters

      • seconds: number

      Returns void

    • Parameters

      • cacheStore: CacheStore
      • expirationMs: number = DEFAULT_CACHE_EXPIRATION_MS

      Returns Promise<number>

    • Create GtfsSqlJs instance from existing SQLite database

      Parameters

      • database: ArrayBuffer
      • options: FactoryOptions

      Returns Promise<GtfsSqlJs>

    • Create GtfsSqlJs instance from GTFS ZIP file path or URL

      Parameters

      • zipPath: string
      • options: FactoryOptions

      Returns Promise<GtfsSqlJs>

    • Create GtfsSqlJs instance from pre-loaded GTFS ZIP data

      Parameters

      • zipData: ArrayBuffer | Uint8Array<ArrayBufferLike>
      • options: FactoryOptions
      • Optionalsource: string

        Optional original path/URL, used for cache key generation and metadata

      Returns Promise<GtfsSqlJs>

    • Parameters

      Returns Promise<
          {
              activeEntries: number;
              expiredEntries: number;
              newestEntry: number
              | null;
              oldestEntry: number | null;
              totalEntries: number;
              totalSize: number;
              totalSizeMB: string;
          },
      >