node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »



erk is

  • useful for working with the IRC protocol
  • leveraging the powerful PEG.js parser generator for JavaScript
  • fully compliant with IRC Message Format RFC 2812 (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!

$ npm run-script peg


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

erk.Parser — converts an IRC-formatted string to an erk.Message

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) {
// connect to output 
// write a message 
// empty fields pruned from output 
//=> {"command":"PING","parameters":[""]} 

erk.Composer — converts a JavaScript object to an IRC-formatted message

var erk = require("erk");
// create a new composer 
var composer = new erk.Composer();
// connect to output 
// write a message 
composer.write({command: "PONG", parameters: [""]});
//=> PONG 


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

$ npm test

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