node-reporter

Reporter entries helper functions

Usage no npm install needed!

<script type="module">
  import nodeReporter from 'https://cdn.skypack.dev/node-reporter';
</script>

README

node-reporter

node-reporter is a node.js module to retrieve and manipulate report files from the Reporter Application.

Installation

$ npm install node-reporter

Examples

var Reporter = require('node-reporter');

var reporter = new Reporter({ directory: '/reports' });
var reports = reporter.list({ connection: 'cellular' });
var questions = reporter.questions();

console.log(reports);

// OR with a callback:

reporter.list({ connection: 'wifi' }, function(err, reports) {
  console.log(reports.length);
})

Methods

Reporter

The constructor optionally can take an object containing the directory of the reports. By default, it will use ~/Dropbox/Apps/Reporter-App/.

Reporter#questions

List the questions asked in a report with their default value.

Reporter#list(options)

List all the entries filtered by options. options is an object allowing you to filer reports by type, connection and/or date Can either return the reports or pass them to a callback.

The type field can take the following values:

  • 'button'
  • 'buttonAsleep'
  • 'notification'
  • 'sleep'
  • 'wake'

The connection field can take the following values:

  • 'cellular'
  • 'wifi'
  • 'none'

The date field is a Date object.

The between field is an object used like this:

var startDate = new Date('2014-02-01')
var endDate = new Date('2014-03-01')

reporter.list({ between: { start: startDate, end: endDate } })

Contributing

Pull requests are welcome! Fork the repo on GitHub

License

MIT.