asker-hat

Wrapper for Asker module for dumping of the received data, and usage of the collected dump instead of actual http requests.

npm install asker-hat
7 downloads in the last week
11 downloads in the last month

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
    
  2. Add to your code
    require('asker-hat')(Asker);
    
  3. 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
  4. Module will collect the dump in /tmp/asker-hat-<pid>-<timestamp> folder.
  5. 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
  6. To turn off dump usage:
    • call Asker.hat.off()
    • send SIGUSR2 to Node.js process again :)
  7. 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);
    
  3. 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

npm loves you