domain.enter()

domain.enter() The enter method is plumbing used by the run, bind, and intercept methods to set the active domain. It sets domain.active and process.domain to the domain, and implicitly pushes the domain onto the domain stack managed by the domain module (see domain.exit() for details on the domain stack). The call to enter delimits the beginning of a chain of asynchronous calls and I/O operations bound to a domain. Calling enter changes only the active domain, and does not alter the domain it

domain.dispose()

domain.dispose() Stability: 0 - Deprecated. Please recover from failed IO actions explicitly via error event handlers set on the domain. Once dispose has been called, the domain will no longer be used by callbacks bound into the domain via run, bind, or intercept, and a 'dispose' event is emitted.

domain.create()

domain.create() return: <Domain> Returns a new Domain object.

domain.intercept()

domain.intercept(callback) callback <Function> The callback function return: <Function> The intercepted function This method is almost identical to domain.bind(callback). However, in addition to catching thrown errors, it will also intercept Error objects sent as the first argument to the function. In this way, the common if (err) return callback(err); pattern can be replaced with a single error handler in a single place. Example const d = domain.create(); function readSomeFil

domain.exit()

domain.exit() The exit method exits the current domain, popping it off the domain stack. Any time execution is going to switch to the context of a different chain of asynchronous calls, it's important to ensure that the current domain is exited. The call to exit delimits either the end of or an interruption to the chain of asynchronous calls and I/O operations bound to a domain. If there are multiple, nested domains bound to the current execution context, exit will exit any domains nested with

domain.add()

domain.add(emitter) emitter <EventEmitter> | <Timer> emitter or timer to be added to the domain Explicitly adds an emitter to the domain. If any event handlers called by the emitter throw an error, or if the emitter emits an 'error' event, it will be routed to the domain's 'error' event, just like with implicit binding. This also works with timers that are returned from setInterval() and setTimeout(). If their callback function throws, it will be caught by the domain 'error' han

domain.bind()

domain.bind(callback) callback <Function> The callback function return: <Function> The bound function The returned function will be a wrapper around the supplied callback function. When the returned function is called, any errors that are thrown will be routed to the domain's 'error' event. Example const d = domain.create(); function readSomeFile(filename, cb) { fs.readFile(filename, 'utf8', d.bind((er, data) => { // if this throws, it will also be passed to the domain

Domain

Class: Domain The Domain class encapsulates the functionality of routing errors and uncaught exceptions to the active Domain object. Domain is a child class of EventEmitter. To handle the errors that it catches, listen to its 'error' event.

dns.reverse()

dns.reverse(ip, callback) Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an array of hostnames. The callback function has arguments (err, hostnames), where hostnames is an array of resolved hostnames for the given ip. On error, err is an Error object, where err.code is one of the DNS error codes.

dns.setServers()

dns.setServers(servers) Sets the IP addresses of the servers to be used when resolving. The servers argument is an array of IPv4 or IPv6 addresses. If a port specified on the address it will be removed. An error will be thrown if an invalid address is provided. The dns.setServers() method must not be called while a DNS query is in progress.