Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-admin

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-admin - npm Package Compare versions

Comparing version 3.0.0 to 4.0.0

16

index.d.ts
/**
Check if the process is running as Administrator on Windows.
Check if the process is running as administrator on Windows.
@returns Whether the process is running as Administrator.
@returns Whether the process is running as administrator.
@example
```
import isAdmin = require('is-admin');
import isAdmin from 'is-admin';
(async () => {
console.log(await isAdmin());
//=> false
})();
console.log(await isAdmin());
//=> false
```
*/
declare function isAdmin(): Promise<boolean>;
export = isAdmin;
export default function isAdmin(): Promise<boolean>;

@@ -1,3 +0,3 @@

'use strict';
const execa = require('execa');
import process from 'node:process';
import execa from 'execa';

@@ -9,3 +9,3 @@ // https://stackoverflow.com/a/28268802

return true;
} catch (_) {
} catch {
return false;

@@ -15,3 +15,3 @@ }

module.exports = async () => {
export default async function isAdmin() {
if (process.platform !== 'win32') {

@@ -22,5 +22,4 @@ return false;

try {
// TODO: Convert this to not use `.shell` as it's slighly faster
// https://stackoverflow.com/a/21295806/1641422
await execa.shell('fsutil dirty query %systemdrive%');
await execa('fsutil', ['dirty', 'query', process.env.systemdrive]);
return true;

@@ -34,2 +33,2 @@ } catch (error) {

}
};
}
{
"name": "is-admin",
"version": "3.0.0",
"description": "Check if the process is running as Administrator on Windows",
"version": "4.0.0",
"description": "Check if the process is running as administrator on Windows",
"license": "MIT",
"repository": "sindresorhus/is-admin",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=8"
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},

@@ -38,9 +41,9 @@ "scripts": {

"dependencies": {
"execa": "^1.0.0"
"execa": "^5.1.1"
},
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
"ava": "^3.15.0",
"tsd": "^0.17.0",
"xo": "^0.44.0"
}
}
# is-admin
> Check if the process is running as Administrator on Windows
> Check if the process is running as administrator on Windows
## Install

@@ -12,15 +11,11 @@

## Usage
```js
const isAdmin = require('is-admin');
import isAdmin from 'is-admin';
(async () => {
console.log(await isAdmin());
//=> false
})();
console.log(await isAdmin());
//=> false
```
## API

@@ -30,12 +25,6 @@

Returns a `Promise<boolean>` indicating whether the process is running as Administrator.
Returns a `Promise<boolean>` indicating whether the process is running as administrator.
## Related
- [is-elevated](https://github.com/sindresorhus/is-elevated) - Check if the process is running with elevated privileges *(cross-platform)*
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc