Node JS offers several Inbuilt core objects. Here we gonna discuss about one of the important Core Object - Process . The process object is a global object and can be accessed from anywhere. Here I have listed out few Methods and properties of an Object. Process Events Event: 'exit' Emitted when the process is about to exit. There is no way to prevent the exiting of the event loop at this point, and once all exit listeners have finished running the process will exit. Therefore you must only perform synchronous operations in this handler. process.on( 'exit' , function (code) { // Sync function only console .log( 'About to exit with code:' , code); }); Event: 'beforeExit' This event is emitted when node empties it's event loop and has nothing else to schedule. Normally, node exits when there is no work scheduled, but a listener for 'beforeExit' can make asynchronous calls, and cause no...
Learn Node JS Easily manner with Real time examples.