robertbira

Italian Translation Report: Node.js [Part 40 - 1083 words]

Oct 7th, 2018
155
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Emitted after the worker IPC channel has disconnected.
  2. This can occur when a worker exits gracefully, is killed, or is disconnected manually (such as with
  3. There may be a delay between the and events.
  4. These events can be used to detect if the process is stuck in a cleanup or if there are long-living connections.
  5. The exit code, if it exited normally.
  6. The name of the signal, that caused the process to be killed.
  7. When any of the workers die the cluster module will emit the event.
  8. This can be used to restart the worker by calling again.
  9. See
  10. When a new worker is forked the cluster module will emit a event.
  11. This can be used to log worker activity, and create a custom timeout.
  12. After calling from a worker, when the event is emitted on the server a event will also be emitted on in the master.
  13. The event handler is executed with two arguments, the contains the worker object and the object contains the following connection properties: and
  14. This is very useful if the worker is listening on more than one address.
  15. The is one of:
  16. Emitted when the cluster master receives a message from any worker.
  17. Before Node.js v6.0, this event emitted only the message and the handle, but not the worker object, contrary to what the documentation stated.
  18. If support for older versions is required but a worker object is not required, it is possible to work around the discrepancy by checking the number of arguments:
  19. After forking a new worker, the worker should respond with an online message.
  20. When the master receives an online message it will emit this event.
  21. The difference between and is that fork is emitted when the master forks a worker, and is emitted when the worker is running.
  22. Emitted every time is called.
  23. The object is the object at the time was called and is advisory only, since multiple calls to can be made in a single tick.
  24. If accuracy is important, use
  25. Called when all workers are disconnected and handles are closed.
  26. Calls on each worker in
  27. When they are disconnected all internal handles will be closed, allowing the master process to die gracefully if no other event is waiting.
  28. The method takes an optional callback argument which will be called when finished.
  29. This can only be called from the master process.
  30. Key/value pairs to add to worker process environment.
  31. Spawn a new worker process.
  32. This can only be called from the master process.
  33. True if the process is a master.
  34. This is determined by the
  35. If is undefined, then is
  36. True if the process is not a master (it is the negation of
  37. The scheduling policy, either for round-robin or to leave it to the operating system.
  38. This is a global setting and effectively frozen once either the first worker is spawned, or is called, whichever comes first.
  39. is the default on all operating systems except Windows.
  40. Windows will change to once libuv is able to effectively distribute IOCP handles without incurring a large performance hit.
  41. can also be set through the environment variable.
  42. Valid values are and
  43. List of string arguments passed to the Node.js executable.
  44. File path to worker file.
  45. String arguments passed to worker.
  46. Current working directory of the worker process.
  47. (inherits from parent process).
  48. Whether or not to send output to parent's stdio.
  49. Configures the stdio of forked processes.
  50. Because the cluster module relies on IPC to function, this configuration must contain an entry.
  51. When this option is provided, it overrides
  52. Sets the user identity of the process.
  53. Sets the group identity of the process.
  54. Sets inspector port of worker.
  55. This can be a number, or a function that takes no arguments and returns a number.
  56. By default each worker gets its own port, incremented from the master's
  57. Hide the forked processes console window that would normally be created on Windows systems.
  58. After calling or this settings object will contain the settings, including the default values.
  59. This object is not intended to be changed or set manually.
  60. is used to change the default 'fork' behavior
  61. Once called, the settings will be present in
  62. Note that:
  63. Any settings changes only affect future calls to and have no effect on workers that are already running.
  64. The only attribute of a worker that cannot be set via is the passed to
  65. The defaults above apply to the first call only, the defaults for later calls is the current value at the time of is called.
  66. This can only be called from the master process.
  67. A reference to the current worker object. Not available in the master process.
  68. A hash that stores the active worker objects, keyed by field. Makes it easy to loop through all the workers. It is only available in the master process.
  69. A worker is removed from after the worker has disconnected and exited.
  70. The order between these two events cannot be determined in advance.
  71. However, it is guaranteed that the removal from the list happens before last or event is emitted.
  72. Go through all workers
  73. Using the worker's unique id is the easiest way to locate the worker.
  74.  
  75.  
  76.  
  77. The module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.
  78. The module exports two specific components:
  79. A class with methods such as and that can be used to write to any Node.js stream.
  80. A global instance configured to write to and
  81. The global can be used without calling
  82. Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams.
  83. See the note on process I/O for more information.
  84. Example using the global
  85. Prints
  86. Example using the class:
  87. The class can be used to create a simple logger with configurable output streams and can be accessed using either or (or their destructured counterparts):
  88. Ignore errors when writing to the underlying streams.
  89. Set color support for this instance.
  90. Setting to enables coloring while inspecting values, setting to will make color support depend on the value of the property and the value returned by on the respective stream.
  91. Creates a new with one or two writable stream instances.
  92. is a writable stream to print log or info output.
  93. is used for warning or error output.
  94. If is not provided, is used for
  95. custom simple logger
  96. use it like console
  97. The global is a special whose output is sent to
  98. and
  99. It is equivalent to calling:
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×