asker-hat

0.0.2 • Public • Published

Asker's Hat

It's a wrapper for Asker module.

With asker-hat you can dump all received data to files. After dumping you can use collected data instead of doing actual HTTP requests. It can be useful for profiling your app, as it will exclude network lag or HTTP stack issues.

Usage

  1. Install asker-hat
npm install asker-hat
  1. Add to your code
require('asker-hat')(Asker);
  1. Switch asker-hat to collecting dump mode in one of the following ways:
  • call Asker.hat.dump() in your code
  • send SIGUSR2 signal to Node.js process
  1. Module will collect the dump in /tmp/asker-hat-<pid>-<timestamp> folder.
  2. When dumping is done, switch asker-hat to use dump mode in one of the following ways:
  • call Asker.hat.useDump()
  • send SIGUSR2 to Node.js process again
  1. To turn off dump usage:
  • call Asker.hat.off()
  • send SIGUSR2 to Node.js process again :)
  1. Call Asker.hat.restore() to take off the hat.

Usage with vow-asker

Required vow-asker ≥0.2.0

  1. Install asker-hat.
  2. Add to your code
require('asker-hat')(ask);
  1. Usage is the same as if you use asker directly.

Options

Pass options hash as second argument to asker-hat:

require('asker-hat')(Asker, options);
  • {String} path = '<OS_TEMP_DIR>/asker-hat-<PID>-<TIMESTAMP>'
  • {Array} env = ['testing', 'development']
  • {Boolean} partial = false
  • {String} signal = 'SIGUSR2'
  • {Function} sanitizer (Object options)

Sanitizing of the options hash

@todo

Readme

Keywords

none

Package Sidebar

Install

npm i asker-hat

Weekly Downloads

1

Version

0.0.2

License

none

Last publish

Collaborators

  • twilightfeel