/** * Lazy GTFS archive parser with streaming CSV support. * * Only parses CSV files when they are accessed, not upfront. * Uses shared CsvParseStream for true line-by-line streaming. * * @module */ import type { GtfsAgency, GtfsRoute, GtfsShapePoint, GtfsStop, GtfsStopTime, GtfsTrip } from "./types.ts"; /** * Map of GTFS filenames to their record types. */ export interface GtfsFileTypeMap { "agency.txt": GtfsAgency; "stops.txt": GtfsStop; "routes.txt": GtfsRoute; "trips.txt": GtfsTrip; "stop_times.txt": GtfsStopTime; "shapes.txt": GtfsShapePoint; } /** Valid GTFS filenames that can be parsed. */ export type GtfsFileName = keyof GtfsFileTypeMap; /** * Lazy GTFS archive that only parses files on demand. * * Files are read from the zip and parsed only when their * corresponding iterator is called for the first time. * Iterators yield typed rows one record at a time. */ export declare class GtfsArchive { private entries; private constructor(); /** * Create a GtfsArchive from zip data. */ static fromZip(zipData: ArrayBuffer | Uint8Array): GtfsArchive; /** * Check if a file exists in the archive. */ hasFile(filename: string): boolean; /** * List all files in the archive. */ listFiles(): string[]; /** * Get a readable stream of bytes for a file. */ private getFileBytes; /** * Stream parse a CSV file, yielding typed records one at a time. * * The return type is automatically inferred based on the filename: * - `"stops.txt"` → `AsyncGenerator` * - `"routes.txt"` → `AsyncGenerator` * - `"shapes.txt"` → `AsyncGenerator` * - etc. * * @param filename - The GTFS filename to parse (e.g., "stops.txt") * @returns An async generator yielding typed records * * @example * ```ts * for await (const stop of archive.iter("stops.txt")) { * console.log(stop.stop_name) // TypeScript knows this is GtfsStop * } * ``` */ iter(filename: F): AsyncGenerator; } //# sourceMappingURL=gtfs-archive.d.ts.map