npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

gtfs-to-json

v0.1.5

Published

Generate JSON of transit route data from a GTFS file

Readme

GTFS-to-JSON

Generate JSON of transit route data from a GTFS file

Installation

npm install gtfs-to-json -g

Usage

gtfs-to-json runs from the command line. By default it looks for a config.json file in the directory it is run from.

gtfs-to-json

You can also specify a path to a config file:

gtfs-to-json --config /path/to/your/custom-config.json

To skip re-downloading and re-importing the GTFS and just regenerate JSON from data already imported into SQLite:

gtfs-to-json --skipImport

For each agency, a folder is created under output/<agencyKey> containing a <agencyKey>.json file with route and stop data, plus a log.txt describing the import.

Configuration

gtfs-to-json uses a config.json file to define one or more GTFS agencies to import and export as JSON. Each entry in the agencies array can specify either a url to download the GTFS from or a local path to a GTFS file or folder.

{
  "agencies": [
    {
      "agencyKey": "county-bus",
      "url": "https://county.gov/gtfs.zip"
    }
  ]
}

Config options

| option | type | description | | --- | --- | --- | | agencies | array | Required. An array of agencies to import, each with the options below. | | sqlitePath | string | Full path to the SQLite database used to store imported GTFS data. Defaults to an in-memory database. | | skipImport | boolean | If true, don't download or import GTFS data — just regenerate JSON from the existing SQLite database. | | ignoreDuplicates | boolean | If true, ignore duplicate entries encountered while importing GTFS data instead of throwing an error. | | verbose | boolean | If false, disable console logging. Defaults to true. |

Agency options

| option | type | description | | --- | --- | --- | | agencyKey | string | Required. A short name used to identify the agency and name its output folder/file. | | url | string | URL to download the agency's GTFS zip file from. Either url or path is required. | | path | string | Path to a local GTFS zip file or folder. Either url or path is required. | | agencyId | string | number | Optional. If a GTFS feed contains data for multiple agencies (as identified by agency_id in agency.txt), set this to only include routes and stops served by that agency in the output JSON. |

This is useful for shared regional GTFS feeds that bundle several agencies together. For example, the following two config entries both pull from the same feed but each only outputs the routes/stops for their respective agency:

{
  "agencies": [
    {
      "agencyKey": "kanan",
      "url": "https://govcbus.com/gtfs",
      "agencyId": 144
    },
    {
      "agencyKey": "gctd",
      "url": "https://govcbus.com/gtfs",
      "agencyId": 139
    }
  ]
}