Represents a uloop handle instance as returned by handle().
Example
const handle = uloop.handle(…);
handle.fileno();
handle.handle();
handle.delete();
- Source
- See
Methods
delete() → {void}
Unregisters the uloop handle.
This method unregisters the uloop handle from the uloop event loop and frees any associated resources. After calling this method, the handle instance should no longer be used.
Returns: void
This function does not return a value.
Example
// Unregister the uloop handle and free associated resources
handle.delete();
printf("Handle deleted successfully\n");
- Source
fileno() → {number}
Returns the file descriptor number.
This method returns the file descriptor number associated with the underlying handle, which might refer to a socket or file instance.
Returns: number
The file descriptor number associated with the handle.
Example
// Get the file descriptor number associated with the uloop handle
const fd = handle.fileno();
printf("File descriptor number: %d\n", fd);
- Source
handle() → {module:fs.file|module:fs.proc|module:socket.socket}
Returns the underlying file or socket instance.
This method returns the underlying file or socket instance associated with the uloop handle.
Returns: module:fs.file | module:fs.proc | module:socket.socket
The underlying file or socket instance associated with the handle.
Example
// Get the associated file or socket instance
const fileOrSocket = handle.handle();
printf("Handle: %s\n", fileOrSocket); // e.g. <socket 0x5> or <fs.proc …>
- Source