3.0.0 • Published 6 years ago

overrustle-logs v3.0.0

Weekly downloads
14
License
MIT
Repository
github
Last release
6 years ago

overrustle-logs

Build Status Dependency Status

Streaming download of OverRustle logs.

Example

In this example, we get a stream of all destiny.gg messages from a given date, "stringify" the parsed objects with ndjson, and finally pipe to stdout:

var logs = require('overrustle-logs');
var ndjson = require('ndjson');

logs({
  channel: 'Destinygg',
  date: '2015-10-21'
}).pipe(ndjson.serialize()).pipe(process.stdout);

We can also get messages from a specific user. In this example, we will use the 'data' event just for the sake of showing how there are many ways to consume streams in general:

var logs = require('overrustle-logs');

logs({
  channel: 'Destinygg',
  date: '2015-10-21',
  user: 'sztanpet'
}).on('data', function(data) {
  console.log(JSON.stringify(data));
});

Installation

$ npm install overrustle-logs

API

var logs = require('overrustle-logs');

logs(opts)

Returns a Readable stream of Objects that each represent a message. opts is an Object whose properties should be:

  • opts.channel: String name of channel to download logs of. This is non-optional.
  • opts.date: String date. If you are getting the entire logs of a channel, you must provide the year, month, and day. If you are getting the logs for a specific user, you only need to provide year and month. The format should be parseable by moment (just use the ISO-8601 standard). This is non-optional.
  • opts.user: String username of user you want to download logs of. This is optional.

Here is an example of an Object that the stream with emit:

{
  timestamp: '2015-10-21T23:59:59.000Z',
  user: 'RustleBot',
  message: 'YEE'
}
3.0.0

6 years ago

2.0.2

8 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago