utilium 3.4.1 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/node.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ /** Whether this process is running with escalated privileges */
2
+ export declare const isRoot: boolean;
package/dist/node.js ADDED
@@ -0,0 +1,16 @@
1
+ // SPDX-License-Identifier: LGPL-3.0-or-later
2
+ // Copyright (c) 2026 James Prevett
3
+ // Misc. Node.js utilities
4
+ /** Whether this process is running with escalated privileges */
5
+ export const isRoot = 'process' in globalThis
6
+ && (process.platform === 'win32'
7
+ ? process
8
+ .getBuiltinModule?.('child_process')
9
+ .spawnSync((process.env.SystemRoot || 'C:\\Windows') + '\\System32\\fltmc.exe', {
10
+ stdio: 'ignore',
11
+ windowsHide: true,
12
+ }).status === 0
13
+ : process.geteuid?.() === 0
14
+ || process.getegid?.() === 0
15
+ || process.getuid?.() === 0
16
+ || process.getgid?.() === 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "utilium",
3
- "version": "3.4.1",
3
+ "version": "3.5.0",
4
4
  "description": "Typescript utilities",
5
5
  "funding": {
6
6
  "type": "individual",