asker-hat
v0.0.2
Published
Wrapper for Asker module for dumping of the received data, and usage of the collected dump instead of actual http requests.
Downloads
4
Readme
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
- Install asker-hat
npm install asker-hat
- Add to your code
require('asker-hat')(Asker);
- 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
- Module will collect the dump in
/tmp/asker-hat-<pid>-<timestamp>
folder. - 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
- To turn off dump usage:
- call
Asker.hat.off()
- send
SIGUSR2
to Node.js process again :)
- Call
Asker.hat.restore()
to take off the hat.
Usage with vow-asker
Required vow-asker ≥0.2.0
- Install
asker-hat
. - Add to your code
require('asker-hat')(ask);
- 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