0.1.3 • Published 7 years ago

gtop-parser v0.1.3

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

NodeJS GTOP Parser

Build Status Dependency status codecov

A streaming nodejs GTOP parser, which validates every message against the JSON schema. Currently up to GTOP spec draft 01/

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

The GTOP parser assumes a NodeJS environment. So go ahead and make sure you've got that setup, as well as yarn.

Installing

Add GTOP parser as a dependency:

$ yarn add gtop-parser

Cool. Now, use it:

const Parser = require('gtop-parser');

const gtopParser = new Parser();

gtopParser.on('testStarted', testStarted => {
    console.log(testStarted);
})

gtopParser.write(JSON.stringify({
    testStarted: {
        name: "This is my test!",
        id: "5226c9ce-0dc8-4ca5-95f7-23016716be70"
    }
}));

The parser may emit three different types of event:

  • testStarted: the complete GTOP message
  • testResult: the complete GTOP message
  • invalidMessage: a TypeError (which your consumer may then throw, if needed).

Running the tests

$ yarn test

Contributing

Pull requests welcome!

Versioning

We use SemVer for versioning.

License

This project is licensed under the MIT License - see the LICENSE file for details

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago