版博士V2.0程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1 год назад
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # `siginfo`
  2. [![Build Status](https://travis-ci.org/emilbayes/siginfo.svg?branch=master)](https://travis-ci.org/eemilbayes/siginfo)
  3. > Utility module to print pretty messages on SIGINFO/SIGUSR1
  4. `SIGINFO` on BSD / macOS and `SIGUSR1` on Linux, usually triggered by
  5. `Ctrl + T`, are by convention used to print information about
  6. a long running process internal state. Eg. `dd` will tell you how many blocks it
  7. has written and at what speed, while `xz` will tell you progress, compression
  8. ratio and estimated time remaining.
  9. This module wraps both signals, checks if the process is connected to TTY and
  10. lets you do whatever you want.
  11. ## Usage
  12. ```js
  13. var siginfo = require('siginfo')
  14. var pkg = require('./package.json')
  15. siginfo(function () {
  16. console.dir({
  17. version: pkg.version,
  18. uptime: process.uptime()
  19. })
  20. })
  21. ```
  22. ## API
  23. ### `var removeListener = siginfo(queryFn, [force])`
  24. `queryFn` can be used for whatever you want (logging, sending a UDP message, etc.).
  25. Setting `force = true` will attach the event handlers whether a TTY is present
  26. or not.
  27. ## Install
  28. ```sh
  29. npm install siginfo
  30. ```
  31. ## License
  32. [ISC](LICENSE)