0.0.2 • Published 12 years ago
asker-hat v0.0.2
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-hatto collecting dump mode in one of the following ways:
- call
Asker.hat.dump()in your code - send
SIGUSR2signal to Node.js process
- Module will collect the dump in
/tmp/asker-hat-<pid>-<timestamp>folder. - When dumping is done, switch
asker-hatto use dump mode in one of the following ways:
- call
Asker.hat.useDump() - send
SIGUSR2to Node.js process again
- To turn off dump usage:
- call
Asker.hat.off() - send
SIGUSR2to 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
askerdirectly.
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