Skip to content

ElectronProtocol

Unofficial

Registers and intercepts custom protocol schemes for a session.

Import:

import type { ElectronProtocol } from '@obsidian-typings/obsidian-catalyst-latest';

Signature:

export interface ElectronProtocol

Methods

Method Returns Description
interceptBufferProtocol(scheme, handler) boolean Intercepts scheme and uses handler as the new handler which sends a Buffer as a response.
interceptFileProtocol(scheme, handler) boolean Intercepts scheme and uses handler as the new handler which sends a file as a response.
interceptHttpProtocol(scheme, handler) boolean Intercepts scheme and uses handler as the new handler which sends a new HTTP request as a response.
interceptStreamProtocol(scheme, handler) boolean Same as registerStreamProtocol, except that it replaces an existing protocol handler.
interceptStringProtocol(scheme, handler) boolean Intercepts scheme and uses handler as the new handler which sends a string as a response.
isProtocolIntercepted(scheme) boolean Returns whether scheme is already intercepted.
isProtocolRegistered(scheme) boolean Returns whether scheme is already registered.
registerBufferProtocol(scheme, handler) boolean Registers a protocol of scheme that will send a Buffer as a response.
registerFileProtocol(scheme, handler) boolean Registers a protocol of scheme that will send a file as the response.
registerHttpProtocol(scheme, handler) boolean Registers a protocol of scheme that will send an HTTP request as a response.
registerSchemesAsPrivileged(customSchemes) void Registers the given schemes as privileged. Can only be called before the ready event and only once.
registerStreamProtocol(scheme, handler) boolean Registers a protocol of scheme that will send a stream as a response.
registerStringProtocol(scheme, handler) boolean Registers a protocol of scheme that will send a string as a response.
uninterceptProtocol(scheme) boolean Removes the interceptor installed for scheme and restores its original handler.
unregisterProtocol(scheme) boolean Unregisters the custom protocol of scheme.

Links to this page: