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

MethodReturnsDescription
interceptBufferProtocol(scheme, handler)booleanIntercepts scheme and uses handler as the new handler which sends a Buffer as a response.
interceptFileProtocol(scheme, handler)booleanIntercepts scheme and uses handler as the new handler which sends a file as a response.
interceptHttpProtocol(scheme, handler)booleanIntercepts scheme and uses handler as the new handler which sends a new HTTP request as a response.
interceptStreamProtocol(scheme, handler)booleanSame as registerStreamProtocol, except that it replaces an existing protocol handler.
interceptStringProtocol(scheme, handler)booleanIntercepts scheme and uses handler as the new handler which sends a string as a response.
isProtocolIntercepted(scheme)booleanReturns whether scheme is already intercepted.
isProtocolRegistered(scheme)booleanReturns whether scheme is already registered.
registerBufferProtocol(scheme, handler)booleanRegisters a protocol of scheme that will send a Buffer as a response.
registerFileProtocol(scheme, handler)booleanRegisters a protocol of scheme that will send a file as the response.
registerHttpProtocol(scheme, handler)booleanRegisters a protocol of scheme that will send an HTTP request as a response.
registerSchemesAsPrivileged(customSchemes)voidRegisters the given schemes as privileged. Can only be called before the ready event and only once.
registerStreamProtocol(scheme, handler)booleanRegisters a protocol of scheme that will send a stream as a response.
registerStringProtocol(scheme, handler)booleanRegisters a protocol of scheme that will send a string as a response.
uninterceptProtocol(scheme)booleanRemoves the interceptor installed for scheme and restores its original handler.
unregisterProtocol(scheme)booleanUnregisters the custom protocol of scheme.

Links to this page: