# mta-gtfs-realtime-bindings

> Javascript classes generated from the GTFS-realtime protocol buffer specification.

Latest version **0.0.5** (published 2017-02-20) · 0 weekly downloads

## Install

```sh
npm install mta-gtfs-realtime-bindings
pnpm add mta-gtfs-realtime-bindings
yarn add mta-gtfs-realtime-bindings
bun add mta-gtfs-realtime-bindings
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2017-02-20 |
| First published | 2017-02-20 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+12 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Google Inc. -> Forked by Kyle Landell |
| Maintainers | kyle.landell |

## Links

- npm: https://www.npmjs.com/package/mta-gtfs-realtime-bindings
- Repository: https://github.com/klandell/mta-gtfs-realtime-bindings
- Homepage: https://github.com/klandell/mta-gtfs-realtime-bindings#readme
- Issues: https://github.com/klandell/mta-gtfs-realtime-bindings/issues
- npm.io page: https://npm.io/package/mta-gtfs-realtime-bindings

## Dependencies (1)

- [protobufjs](https://npm.io/package/protobufjs.md) 2.0.5

## Recent versions

- 0.0.5 (latest) — 2017-02-20
- 0.0.4 — 2017-02-20

## README

# JavaScript GTFS-realtime Language Bindings

[![npm version](https://badge.fury.io/js/gtfs-realtime-bindings.svg)](http://badge.fury.io/js/gtfs-realtime-bindings)

Provides JavaScript classes generated from the
[GTFS-realtime](https://developers.google.com/transit/gtfs-realtime/) Protocol
Buffer specification.  These classes will allow you to parse a binary Protocol
Buffer GTFS-realtime data feed into JavaScript objects.

These bindings are designed to be used in the [Node.js](http://nodejs.org/)
environment, but with some effort, they can probably be used in other
JavaScript environments as well.

We use the [ProtBuf.js](https://github.com/dcodeIO/ProtoBuf.js) library for
JavaScript Protocol Buffer support.

## Add the Dependency

To use the `mta-gtfs-realtime-bindings` classes in your own project, you need to
first install our [Node.js npm package](https://www.npmjs.com/package/gtfs-realtime-bindings):

```
npm install mta-gtfs-realtime-bindings
```

## Example Code

The following Node.js code snippet demonstrates downloading a GTFS-realtime
data feed from a particular URL, parsing it as a FeedMessage (the root type of
the GTFS-realtime schema), and iterating over the results.

```javascript
const GtfsRealtimeBindings = require('mta-gtfs-realtime-bindings');
const rp = require('request-promise');

rp({
    method: 'GET',
    url: 'http://datamine.mta.info/mta_esi.php?key=MTA_API_KEY',
    encoding: null,
}).then((buf) => {
    const feed = GtfsRealtimeBindings.transit_realtime.FeedMessage.decode(buf);
    feed.entity.forEach((entity) => {
        if (entity.trip_update) {
            console.log(entity.trip_update);
        }
    });
}).catch(e => console.log(e));
```

For more details on the naming conventions for the Javascript classes generated
from the
[gtfs-realtime.proto](https://developers.google.com/transit/gtfs-realtime/gtfs-realtime-proto),
check out the [ProtoBuf.js project](https://github.com/dcodeIO/ProtoBuf.js/wiki)
which we use to handle our Protocol Buffer serialization.

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