Network & Storage
Network & Storage
Info
The network & storage API provides CORS-free HTTP requests, clipboard management, download management, image compression, file store, mail, and auto-update capabilities. All methods are exposed on window.api via the Electron preload bridge.
Network Proxy
netFetch
Performs an HTTP request through the main process, bypassing CORS restrictions.
window.api.netFetch(url: string, options?: NetFetchOptions): Promise<NetFetchResult>| Parameter | Type | Description |
|---|---|---|
url | string | Target URL |
options | NetFetchOptions | Optional: method, headers, body, timeout |
Returns:
| Type | Description |
|---|---|
Promise<NetFetchResult> | { status, headers, body } |
Important
netFetch runs in the main process Node.js context, so it is not subject to browser CORS restrictions. Use it for API calls to third-party services that don't set CORS headers.
Clipboard
clipboardReadText
Reads text from the system clipboard.
window.api.clipboardReadText(): Promise<string>clipboardWriteText
Writes text to the system clipboard.
window.api.clipboardWriteText(text: string): void| Parameter | Type | Description |
|---|---|---|
text | string | Text to write to clipboard |
URL Monitor
| Getter | Setter | Type | Description |
|---|---|---|---|
clipboardUrlMonitorGet | clipboardUrlMonitorSet | boolean | Enable/disable clipboard URL monitoring |
clipboardUrlDetectModeGet | clipboardUrlDetectModeSet | string | URL detection mode |
clipboardUrlBlacklistGet | clipboardUrlBlacklistSet | string[] | Domains to ignore when monitoring URLs |
clipboardUrlBlacklistAddDomain
Adds a domain to the clipboard URL blacklist.
window.api.clipboardUrlBlacklistAddDomain(domain: string): void| Parameter | Type | Description |
|---|---|---|
domain | string | Domain to add (e.g., 'example.com') |
onClipboardUrlsDetected
Listens for URLs detected in the clipboard.
window.api.onClipboardUrlsDetected(callback: (data: ClipboardUrlsDetectedData) => void): () => voidclipboardOpenUrl
Opens a URL from the clipboard in the default browser.
window.api.clipboardOpenUrl(url: string): voidDownload Manager
Info
The download manager provides a full download lifecycle: start, pause, resume, cancel, and remove. Downloads are managed by the main process and tracked via events.
downloadStart
Starts a new download.
window.api.downloadStart(payload: DownloadStartPayload): Promise<DownloadStartResult>| Parameter | Type | Description |
|---|---|---|
payload | DownloadStartPayload | URL, filename, and save path |
downloadCancel
Cancels a running download.
window.api.downloadCancel(taskId: string): voiddownloadPause
Pauses a running download.
window.api.downloadPause(taskId: string): voiddownloadResume
Resumes a paused download.
window.api.downloadResume(taskId: string): voiddownloadRemove
Removes a download task from the list.
window.api.downloadRemove(taskId: string): voiddownloadList
Returns all download tasks.
window.api.downloadList(): Promise<DownloadTask[]>downloadPickSavePath
Opens a folder picker for selecting the download save location.
window.api.downloadPickSavePath(): Promise<string | null>downloadGetDefaultDir
Returns the default download directory.
window.api.downloadGetDefaultDir(): Promise<string>onDownloadTaskUpdated
Listens for download task state changes.
window.api.onDownloadTaskUpdated(callback: (task: DownloadTask) => void): () => voidImage Compression
| Method | Signature | Description |
|---|---|---|
imageCompressionPickImages | () => Promise<string[]> | Open file picker for images |
imageCompressionPickOutputDir | () => Promise<string | null> | Open folder picker for output |
imageCompressionStart | (payload: ImageCompressionStartPayload) => Promise<ImageCompressionStartResult> | Start compression |
imageCompressionList | () => Promise<ImageCompressionTask[]> | List all compression tasks |
imageCompressionRemove | (taskId: string) => void | Remove a task |
onImageCompressionTaskUpdated
window.api.onImageCompressionTaskUpdated(callback: (task: ImageCompressionTask) => void): () => voidFormat Factory
| Method | Signature | Description |
|---|---|---|
pickVideoForExtract | () => Promise<PickVideoForExtractResult> | Open file picker for video |
extractVideoTrack | (options: ExtractVideoTrackOptions) => Promise<ExtractVideoTrackResult> | Extract video track |
File Store
Note
The file store provides simple key-value persistence in the main process. It is used for settings that don't need to be synced across devices.
| Method | Signature | Description |
|---|---|---|
storeRead | (key: string) => Promise<unknown> | Read a value by key |
storeWrite | (key: string, data: unknown) => Promise<void> | Write a value by key |
mailInboxList
Fetches the user's inbox.
window.api.mailInboxList(configOrLimit?: number | object, limit?: number): Promise<MailInboxResult>| Parameter | Type | Description |
|---|---|---|
configOrLimit | number | object | Optional: limit or config object |
limit | number | Optional: max items to return |
Auto Updater
Warning
The auto updater downloads updates in the background. The update is not installed until the user explicitly calls updaterInstall, which triggers a restart.
| Method | Signature | Description |
|---|---|---|
updaterCheck | () => Promise<UpdaterCheckResult> | Check for available updates |
updaterDownload | () => void | Start downloading the update |
updaterInstall | () => void | Install and restart |
updaterVersion | () => Promise<string> | Get current app version |
Updater Events
| Event | Callback Type | Description |
|---|---|---|
onUpdaterProgress | UpdaterProgress | Download progress updates |
onUpdaterDownloaded | UpdaterDownloadedData | Update download completed |
onUpdaterAvailable | UpdaterAvailableData | Update available notification |
onUpdaterNotAvailable | UpdaterNotAvailableData | No update available |
onUpdaterStartupAutoCheckRequest | UpdaterStartupAutoCheckRequestData | Startup auto-check triggered |
Logging
logWrite
Writes a log entry in the main process.
window.api.logWrite(level: string, message: string): void| Parameter | Type | Description |
|---|---|---|
level | string | Log level: 'info', 'warn', 'error', 'debug' |
message | string | Log message |
Note
This is a fire-and-forget call. The main process writes to its log file. Use openLogsFolder (from the App Lifecycle API) to view logs.
Changelog
5296a-on

