# mta-gtfs-jl

> An NYC MTA API library

Latest version **1.2.7** (published 2024-03-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install mta-gtfs-jl
pnpm add mta-gtfs-jl
yarn add mta-gtfs-jl
bun add mta-gtfs-jl
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.7 |
| Published | 2024-03-28 |
| First published | 2021-02-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 41.8 MB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Jeffrey Lu |
| Maintainers | jeffreyclu |
| Keywords | mta, gtfs, nyc, transit |

## Links

- npm: https://www.npmjs.com/package/mta-gtfs-jl
- Repository: https://github.com/jeffreyclu/mta-gtfs
- Issues: https://github.com/jeffreyclu/mta-gtfs/issues
- npm.io page: https://npm.io/package/mta-gtfs-jl

## Dependencies (5)

- [xml2js](https://npm.io/package/xml2js.md) ^0.4.5
- [csv-parse](https://npm.io/package/csv-parse.md) ^4.15.1
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.1
- [underscore](https://npm.io/package/underscore.md) ^1.8.2
- [mta-gtfs-realtime-bindings](https://npm.io/package/mta-gtfs-realtime-bindings.md) ^0.0.5

## Alternatives

- [postcss-color-hex-alpha](https://npm.io/package/postcss-color-hex-alpha.md) — 6.4M weekly downloads
- [randomcolor](https://npm.io/package/randomcolor.md) — 348.0K weekly downloads
- [bows](https://npm.io/package/bows.md) — 1.3K weekly downloads
- [ep_prefer_color_scheme](https://npm.io/package/ep_prefer_color_scheme.md) — 260 weekly downloads
- [coc-yank](https://npm.io/package/coc-yank.md) — 61 weekly downloads

## Recent versions

- 1.2.7 (latest) — 2024-03-28
- 1.2.4 — 2021-02-20
- 1.2.3 — 2021-02-20
- 1.2.2 — 2021-02-19
- 1.2.1 — 2021-02-07
- 1.2.0 — 2021-02-07

## README

# mta-gtfs

An NYC MTA API library

## Install

```
npm install mta-gtfs --save
```

## Usage

### Library

```
const Mta = require('mta-gtfs');
const mta = new Mta();
```
* uses [node-fetch](https://github.com/bitinn/node-fetch) to make http requests
* returns Promise objects and makes use of native Promises (make sure you are using >= Node v0.12)

#### MTA

For feed information, see https://api.mta.info/#/subwayRealTimeFeeds.

### Get subway stop info

Get ids, name, and lat/long for all subway stops.

```Javascript
mta.stop().then(function (result) {
  console.log(result);
}).catch(function (err) {
  console.log(err);
});
```

Get info for specific stop, given an id.

```Javascript
mta.stop(635).then(function (result) {
  console.log(result);
});
```
An array of stop ids may also be passed to this method. 
The stop ids given here are used in `mta.schedule()`.

### Get MTA service status info

You can get ALL service types:

```Javascript
mta.status().then(function (result) {
  console.log(result);
});
```

Or, specify a specific service type (`subway`, `bus`, `BT`, `LIRR`, `MetroNorth`):

```Javascript
mta.status('subway').then(function (result) {
  console.log(result);
});
```

The API route this method hits is updated by the MTA every 60 seconds.

### Get real-time subway schedule data
Only available for the routes found in this [list](http://datamine.mta.info/list-of-feeds).

Given a single subway stop id (or an array of stop ids) and an optional feedId, it gives schedule data for both northbound and southbound trains.

Note: the feedIds in use are provided by `mta.feedIds()`.

```Javascript
mta.schedule(635, '-l').then(function (result) {
  console.log(result);
});
```

The API route this method hits is updated by the MTA every 30 seconds.

## Tests

See [test cases](https://github.com/aamaliaa/mta/blob/master/test/mta.js) for more examples.

## To do

* MTA Bus Time API (http://bustime.mta.info/wiki/Developers/Index)
* return static schedules for lines not included in real-time feeds

---
_Source: https://npm.io/package/mta-gtfs-jl · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
