# erk

> RFC-compliant IRC protocol lib

Latest version **0.2.0** (published 2015-02-02) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install erk
pnpm add erk
yarn add erk
bun add erk
```

## 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.2.0 |
| Published | 2015-02-02 |
| First published | 2013-09-21 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | nkitsune |
| Maintainers | nkitsune |
| Keywords | irc, protocol, parser, composer, stream |

## Links

- npm: https://www.npmjs.com/package/erk
- Repository: https://github.com/mosdefbiz/node-erk
- Issues: https://github.com/mosdefbiz/node-erk/issues
- npm.io page: https://npm.io/package/erk

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2015-02-02
- 0.1.10 — 2014-03-06
- 0.1.8 — 2013-10-01
- 0.1.7 — 2013-09-27
- 0.1.6 — 2013-09-26
- 0.1.5 — 2013-09-23
- 0.1.4 — 2013-09-23
- 0.1.3 — 2013-09-23
- 0.1.2 — 2013-09-23
- 0.1.1 — 2013-09-23
- 0.1.0 — 2013-09-21

## README

# erk

erk **is**

* useful for working with the IRC protocol
* leveraging the powerful [PEG.js][pegjs] parser generator for JavaScript
* fully compliant with IRC Message Format [RFC 2812][rfc] (Section 2.3.1)
* implemented using node.js streams
* supported by an exhaustive test suite

erk is **not**

* a standalone bot/client

-----

##### PEG.js parser

erk currently depends on features that have not been published in the publicly
released `pegjs-0.7.0`. Developers should note that the current dependency is
installing pegjs via `dmajda/pegjs#master`.

After editing `peg/parser.pegjs`, it needs to be rebuilt!

```sh
$ npm run-script peg
```

-----

##### Streams

connect erk to your application using the I/O streams.

**erk.Parser** &mdash; converts an IRC-formatted string to an `erk.Message`

```js
var erk = require("erk"),
    stream = require("stream");

// create a new parser
var parser = new erk.Parser();

// create a dummie output stream
var output = new stream.PassThrough({objectMode: true});

output.on("data", function(message) {
  console.log(JSON.stringify(message));
});

// connect to output
parser.pipe(output);

// write a message
parser.write("PING :irc.freenode.net\r\n");

// empty fields pruned from output
//=> {"command":"PING","parameters":["irc.freenode.net"]}
```

**erk.Composer** &mdash; converts a JavaScript object to an IRC-formatted message

```js
var erk = require("erk");

// create a new composer
var composer = new erk.Composer();

// connect to output
composer.pipe(process.stdout);

// write a message
composer.write({command: "PONG", parameters: ["irc.freenode.net"]});

//=> PONG irc.freenode.net
```

-----

##### Tests

Any contributions will require tests to support them. Run the tests!

```sh
$ npm test
```

**Note:** running this command will automatically rebuild the PEG.js parser.

[pegjs]: https://github.com/dmajda/pegjs
[rfc]: http://tools.ietf.org/html/rfc2812#section-2.3.1

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