Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
E

electron-util

> 包管理
Open source

Useful utilities for Electron apps and modules

1.3K stars0 likes1 views
WebsiteGitHub

About

Useful utilities for Electron apps and modules

electron-util

Useful utilities for Electron apps and modules

You can use this package directly in both the main and renderer process.

This package is organized into three parts:

  • shared - APIs that work in both the main and renderer process
  • main - APIs that only work in the main process (requires Electron APIs)
  • node - APIs that work in any Node.js environment, even outside Electron (pure Node.js utilities for detecting Electron environment, ASAR usage, etc.)

To use features from the "main" part in the renderer process, you will need to set up IPC channels.

Install

bash
npm install electron-util

[!NOTE] Requires Electron 37 or later.

Usage

The “shared” API you can access directly:

typescript
import {is} from 'electron-util';

console.log(is.macos && is.main);
//=> true

For the “main” API, use the /main sub-export:

typescript
import {isDev} from 'electron-util/main';

console.log(isDev);
//=> false

For the “node” API, use the /node sub-export:

typescript
import {isElectron, fixPathForAsarUnpack} from 'electron-util/node';

console.log(isElectron);
//=> true when running in Electron, false in plain Node.js

const fixedPath = fixPathForAsarUnpack('/path/app.asar/binary');
//=> '/path/app.asar.unpacked/binary' when in ASAR, or unchanged otherwise

API

Documentation (The service is broken)

Look at the types for now.

Related

  • electron-store - Save and load data like user preferences, app state, cache, etc
  • electron-debug - Adds useful debug features to your Electron app
  • electron-context-menu - Context menu for your Electron app
  • electron-dl - Simplified file downloads for your Electron app
  • electron-unhandled - Catch unhandled errors and promise rejections in your Electron app

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptelectronelectron-modulenodejsnpm-package

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category包管理
PricingOpen source

> Related tools

N
npm
Node.js 默认包管理器
P
pnpm
高效节省磁盘的 Node 包管理器
I
is-gif
Check if a Buffer/Uint8Array is a GIF image