Header menu logo fable-electron-docs-api

Utility Module

Types and nested modules

Type/Module Description

ClientRequest (Module)

Constants

Enums

Net

ParentPort

SystemPreferences

UtilityProcess (Module)

ClientRequest (Type)

⚠ Process Availability: Main ✔ | Renderer ❌ | Utility ✔ | Exported ❌

Make HTTP/HTTPS requests.Process: Main, Utility _This class is not exported from the 'electron' module. It is only available as a return value of other methods in the Electron API._ClientRequest implements the Writable Stream interface and is therefore an EventEmitter.

IncomingMessage

⚠ Process Availability: Main ✔ | Renderer ❌ | Utility ✔ | Exported ❌

UtilityProcess (Type)

⚠ Process Availability: Main ✔ | Renderer ✔ | Utility ✔ | Exported ❌

net

⚠ Process Availability: Main ✔ | Renderer ❌ | Utility ✔ | Exported ✔

Issue HTTP/HTTPS requests using Chromium's native networking libraryProcess: Main, UtilityThe net module is a client-side API for issuing HTTP(S) requests. It is similar to the HTTP and HTTPS modules of Node.js but uses Chromium's native networking library instead of the Node.js implementation, offering better support for web proxies. It also supports checking network status.The following is a non-exhaustive list of why you may consider using the net module instead of the native Node.js modules:* Automatic management of system proxy configuration, support of the wpad protocol and proxy pac configuration files.* Automatic tunneling of HTTPS requests.* Support for authenticating proxies using basic, digest, NTLM, Kerberos or negotiate authentication schemes.* Support for traffic monitoring proxies: Fiddler-like proxies used for access control and monitoring.The API components (including classes, methods, properties and event names) are similar to those used in Node.js.Example usage:const { app } = require('electron')app.whenReady().then(() => { const { net } = require('electron') const request = net.request('https://github.com') request.on('response', (response) => { console.log(STATUS: \({response.statusCode}) console.log(HEADERS:\){JSON.stringify(response.headers)}) response.on('data', (chunk) => { console.log(BODY: ${chunk}) }) response.on('end', () => { console.log('No more data in response.') }) }) request.end()})The net API can be used only after the application emits the ready event. Trying to use the module before the ready event will throw an error.

parentPort

⚠ Process Availability: Main ❌ | Renderer ❌ | Utility ✔ | Exported ✔

Interface for communication with parent process.Process: UtilityparentPort is an EventEmitter. This object is not exported from the 'electron' module. It is only available as a property of the process object in the Electron API.

systemPreferences

⚠ Process Availability: Main ✔ | Renderer ❌ | Utility ✔ | Exported ✔

Get system preferences.Process: Main, Utility

Type something to start searching.