@ohos-ports/stdlib-process 0.0.0-stage → 0.4.1-beta.1
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/LICENSE +177 -0
- package/NOTICE +1 -0
- package/README.md +220 -2
- package/SECURITY.md +5 -0
- package/argv/README.md +104 -0
- package/argv/docs/repl.txt +22 -0
- package/argv/docs/types/index.d.ts +33 -0
- package/argv/docs/types/test.ts +28 -0
- package/argv/lib/browser.js +28 -0
- package/argv/lib/index.js +40 -0
- package/argv/lib/main.js +43 -0
- package/argv/package.json +70 -0
- package/chdir/README.md +124 -0
- package/chdir/docs/repl.txt +25 -0
- package/chdir/docs/types/index.d.ts +42 -0
- package/chdir/docs/types/test.ts +45 -0
- package/chdir/lib/index.js +42 -0
- package/chdir/lib/main.js +52 -0
- package/chdir/lib/polyfill.js +42 -0
- package/chdir/package.json +73 -0
- package/cwd/README.md +140 -0
- package/cwd/bin/cli +60 -0
- package/cwd/docs/repl.txt +17 -0
- package/cwd/docs/types/index.d.ts +35 -0
- package/cwd/docs/types/test.ts +33 -0
- package/cwd/docs/usage.txt +8 -0
- package/cwd/etc/cli_opts.json +14 -0
- package/cwd/lib/index.js +40 -0
- package/cwd/lib/main.js +44 -0
- package/cwd/lib/polyfill.js +40 -0
- package/cwd/package.json +75 -0
- package/docs/types/index.d.ts +225 -0
- package/env/README.md +104 -0
- package/env/docs/repl.txt +12 -0
- package/env/docs/types/index.d.ts +32 -0
- package/env/docs/types/test.ts +28 -0
- package/env/lib/browser.js +28 -0
- package/env/lib/index.js +39 -0
- package/env/lib/main.js +42 -0
- package/env/package.json +72 -0
- package/exec-path/README.md +90 -0
- package/exec-path/docs/repl.txt +13 -0
- package/exec-path/docs/types/index.d.ts +36 -0
- package/exec-path/docs/types/test.ts +28 -0
- package/exec-path/lib/browser.js +23 -0
- package/exec-path/lib/index.js +55 -0
- package/exec-path/lib/main.js +46 -0
- package/exec-path/package.json +72 -0
- package/getegid/README.md +107 -0
- package/getegid/docs/repl.txt +20 -0
- package/getegid/docs/types/index.d.ts +38 -0
- package/getegid/docs/types/test.ts +33 -0
- package/getegid/lib/index.js +39 -0
- package/getegid/lib/main.js +45 -0
- package/getegid/lib/native.js +44 -0
- package/getegid/lib/polyfill.js +40 -0
- package/getegid/package.json +76 -0
- package/geteuid/README.md +111 -0
- package/geteuid/docs/repl.txt +20 -0
- package/geteuid/docs/types/index.d.ts +38 -0
- package/geteuid/docs/types/test.ts +33 -0
- package/geteuid/lib/index.js +39 -0
- package/geteuid/lib/main.js +45 -0
- package/geteuid/lib/native.js +44 -0
- package/geteuid/lib/polyfill.js +40 -0
- package/geteuid/package.json +76 -0
- package/getgid/README.md +107 -0
- package/getgid/docs/repl.txt +19 -0
- package/getgid/docs/types/index.d.ts +38 -0
- package/getgid/docs/types/test.ts +33 -0
- package/getgid/lib/index.js +39 -0
- package/getgid/lib/main.js +45 -0
- package/getgid/lib/native.js +44 -0
- package/getgid/lib/polyfill.js +40 -0
- package/getgid/package.json +75 -0
- package/getuid/README.md +111 -0
- package/getuid/docs/repl.txt +19 -0
- package/getuid/docs/types/index.d.ts +38 -0
- package/getuid/docs/types/test.ts +33 -0
- package/getuid/lib/index.js +39 -0
- package/getuid/lib/main.js +45 -0
- package/getuid/lib/native.js +44 -0
- package/getuid/lib/polyfill.js +40 -0
- package/getuid/package.json +75 -0
- package/lib/index.js +150 -0
- package/node-version/README.md +135 -0
- package/node-version/bin/cli +60 -0
- package/node-version/docs/repl.txt +12 -0
- package/node-version/docs/types/index.d.ts +42 -0
- package/node-version/docs/types/test.ts +28 -0
- package/node-version/docs/usage.txt +8 -0
- package/node-version/etc/cli_opts.json +14 -0
- package/node-version/lib/browser.js +23 -0
- package/node-version/lib/index.js +60 -0
- package/node-version/lib/main.js +43 -0
- package/node-version/lib/process.js +28 -0
- package/node-version/package.json +73 -0
- package/package.json +121 -4
- package/read-stdin/README.md +152 -0
- package/read-stdin/docs/types/index.d.ts +108 -0
- package/read-stdin/docs/types/test.ts +73 -0
- package/read-stdin/lib/browser.js +66 -0
- package/read-stdin/lib/index.js +47 -0
- package/read-stdin/lib/main.js +159 -0
- package/read-stdin/package.json +67 -0
- package/umask/README.md +281 -0
- package/umask/bin/cli +84 -0
- package/umask/docs/repl.txt +133 -0
- package/umask/docs/types/index.d.ts +69 -0
- package/umask/docs/types/test.ts +62 -0
- package/umask/docs/usage.txt +9 -0
- package/umask/etc/cli_opts.json +22 -0
- package/umask/lib/browser.js +133 -0
- package/umask/lib/from_symbolic.js +218 -0
- package/umask/lib/index.js +40 -0
- package/umask/lib/main.js +128 -0
- package/umask/lib/octal_codes.json +10 -0
- package/umask/lib/to_symbolic.js +57 -0
- package/umask/package.json +78 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
|
|
3
|
+
@license Apache-2.0
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2018 The Stdlib Authors.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
|
|
19
|
+
-->
|
|
20
|
+
|
|
21
|
+
# getegid
|
|
22
|
+
|
|
23
|
+
> Return the effective numeric group identity of the calling process.
|
|
24
|
+
|
|
25
|
+
<section class="usage">
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
var getegid = require( '@stdlib/process/getegid' );
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
#### getegid()
|
|
34
|
+
|
|
35
|
+
Returns the effective numeric group identity of the calling process.
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
var id = getegid();
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
</section>
|
|
42
|
+
|
|
43
|
+
<!-- /.usage -->
|
|
44
|
+
|
|
45
|
+
<section class="notes">
|
|
46
|
+
|
|
47
|
+
## Notes
|
|
48
|
+
|
|
49
|
+
- The function **only** returns an `integer` group identity on POSIX platforms. For all other platforms (e.g., Windows, browsers, and Android), the function returns `null`.
|
|
50
|
+
- See [getegid(2)][getegid].
|
|
51
|
+
|
|
52
|
+
</section>
|
|
53
|
+
|
|
54
|
+
<!-- /.notes -->
|
|
55
|
+
|
|
56
|
+
<section class="examples">
|
|
57
|
+
|
|
58
|
+
## Examples
|
|
59
|
+
|
|
60
|
+
<!-- eslint no-undef: "error" -->
|
|
61
|
+
|
|
62
|
+
```javascript
|
|
63
|
+
var getegid = require( '@stdlib/process/getegid' );
|
|
64
|
+
|
|
65
|
+
var gid = getegid();
|
|
66
|
+
console.log( 'gid: %d', gid );
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
</section>
|
|
70
|
+
|
|
71
|
+
<!-- /.examples -->
|
|
72
|
+
|
|
73
|
+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
|
|
74
|
+
|
|
75
|
+
<section class="related">
|
|
76
|
+
|
|
77
|
+
* * *
|
|
78
|
+
|
|
79
|
+
## See Also
|
|
80
|
+
|
|
81
|
+
- <span class="package-name">[`@stdlib/process/geteuid`][@stdlib/process/geteuid]</span><span class="delimiter">: </span><span class="description">return the effective numeric user identity of a calling process.</span>
|
|
82
|
+
- <span class="package-name">[`@stdlib/process/getgid`][@stdlib/process/getgid]</span><span class="delimiter">: </span><span class="description">return the numeric group identity of a calling process.</span>
|
|
83
|
+
- <span class="package-name">[`@stdlib/process/getuid`][@stdlib/process/getuid]</span><span class="delimiter">: </span><span class="description">return the numeric user identity of a calling process.</span>
|
|
84
|
+
|
|
85
|
+
</section>
|
|
86
|
+
|
|
87
|
+
<!-- /.related -->
|
|
88
|
+
|
|
89
|
+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
90
|
+
|
|
91
|
+
<section class="links">
|
|
92
|
+
|
|
93
|
+
[getegid]: http://man7.org/linux/man-pages/man2/getegid.2.html
|
|
94
|
+
|
|
95
|
+
<!-- <related-links> -->
|
|
96
|
+
|
|
97
|
+
[@stdlib/process/geteuid]: https://github.com/stdlib-js/process/tree/main/geteuid
|
|
98
|
+
|
|
99
|
+
[@stdlib/process/getgid]: https://github.com/stdlib-js/process/tree/main/getgid
|
|
100
|
+
|
|
101
|
+
[@stdlib/process/getuid]: https://github.com/stdlib-js/process/tree/main/getuid
|
|
102
|
+
|
|
103
|
+
<!-- </related-links> -->
|
|
104
|
+
|
|
105
|
+
</section>
|
|
106
|
+
|
|
107
|
+
<!-- /.links -->
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
{{alias}}()
|
|
3
|
+
Returns the effective numeric group identity of the calling process.
|
|
4
|
+
|
|
5
|
+
The function only returns an effective group identity on POSIX platforms.
|
|
6
|
+
For all other platforms (e.g., Windows and Android), the function returns
|
|
7
|
+
`null`.
|
|
8
|
+
|
|
9
|
+
Returns
|
|
10
|
+
-------
|
|
11
|
+
id: integer|null
|
|
12
|
+
Effective numeric group identity.
|
|
13
|
+
|
|
14
|
+
Examples
|
|
15
|
+
--------
|
|
16
|
+
> var gid = {{alias}}()
|
|
17
|
+
|
|
18
|
+
See Also
|
|
19
|
+
--------
|
|
20
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2019 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// TypeScript Version: 4.1
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Returns the effective numeric group identity of the calling process.
|
|
23
|
+
*
|
|
24
|
+
* ## Notes
|
|
25
|
+
*
|
|
26
|
+
* - The function only returns an effective group identity on POSIX platforms. For all other platforms (e.g., Windows and Android), the function returns `null`.
|
|
27
|
+
*
|
|
28
|
+
* @returns effective numeric group identity or null
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* var gid = getegid();
|
|
32
|
+
*/
|
|
33
|
+
declare function getegid(): number | null;
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
// EXPORTS //
|
|
37
|
+
|
|
38
|
+
export = getegid;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2019 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import getegid = require( './index' );
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
// TESTS //
|
|
23
|
+
|
|
24
|
+
// The function returns a number or null...
|
|
25
|
+
{
|
|
26
|
+
getegid(); // $ExpectType number | null
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// The compiler throws an error if the function is provided arguments...
|
|
30
|
+
{
|
|
31
|
+
getegid( true ); // $ExpectError
|
|
32
|
+
getegid( [], 123 ); // $ExpectError
|
|
33
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2018 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Return the effective numeric group identity of the calling process.
|
|
23
|
+
*
|
|
24
|
+
* @module @stdlib/process/getegid
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* var getegid = require( '@ohos-ports/stdlib-process/getegid' );
|
|
28
|
+
*
|
|
29
|
+
* var gid = getegid();
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
// MODULES //
|
|
33
|
+
|
|
34
|
+
var main = require( './main.js' );
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
// EXPORTS //
|
|
38
|
+
|
|
39
|
+
module.exports = main;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2018 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
// MODULES //
|
|
22
|
+
|
|
23
|
+
var isFunction = require( '@ohos-ports/stdlib-assert/is-function' );
|
|
24
|
+
var polyfill = require( './polyfill.js' );
|
|
25
|
+
var builtin = require( './native.js' );
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
// MAIN //
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Returns the effective numeric group identity of the calling process.
|
|
32
|
+
*
|
|
33
|
+
* @name getegid
|
|
34
|
+
* @type {Function}
|
|
35
|
+
* @returns {(integer|null)} effective numeric group identity or null
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* var gid = getegid();
|
|
39
|
+
*/
|
|
40
|
+
var getegid = ( isFunction( builtin ) ) ? builtin : polyfill;
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
// EXPORTS //
|
|
44
|
+
|
|
45
|
+
module.exports = getegid;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2018 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
// MODULES //
|
|
22
|
+
|
|
23
|
+
var proc = require( 'process' );
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// MAIN //
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Returns the effective numeric group identity of the calling process.
|
|
30
|
+
*
|
|
31
|
+
* @private
|
|
32
|
+
* @name getegid
|
|
33
|
+
* @type {Function}
|
|
34
|
+
* @returns {integer} effective numeric group identity
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* var gid = getegid();
|
|
38
|
+
*/
|
|
39
|
+
var getegid = proc.getegid; // eslint-disable-line n/no-unsupported-features/node-builtins
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
// EXPORTS //
|
|
43
|
+
|
|
44
|
+
module.exports = getegid;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2018 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
// MAIN //
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Polyfill for returning an effective numeric group identity for environments which do not provide native support.
|
|
25
|
+
*
|
|
26
|
+
* @private
|
|
27
|
+
* @returns {null} null
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* var gid = getegid();
|
|
31
|
+
* // returns null
|
|
32
|
+
*/
|
|
33
|
+
function getegid() {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
// EXPORTS //
|
|
39
|
+
|
|
40
|
+
module.exports = getegid;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stdlib/process/getegid",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Return the effective numeric group identity of a calling process.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "The Stdlib Authors",
|
|
8
|
+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
|
|
9
|
+
},
|
|
10
|
+
"contributors": [
|
|
11
|
+
{
|
|
12
|
+
"name": "The Stdlib Authors",
|
|
13
|
+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"main": "./lib",
|
|
17
|
+
"browser": {
|
|
18
|
+
"./lib": "./lib/polyfill.js",
|
|
19
|
+
"process": "process/"
|
|
20
|
+
},
|
|
21
|
+
"directories": {
|
|
22
|
+
"benchmark": "./benchmark",
|
|
23
|
+
"doc": "./docs",
|
|
24
|
+
"example": "./examples",
|
|
25
|
+
"lib": "./lib",
|
|
26
|
+
"test": "./test"
|
|
27
|
+
},
|
|
28
|
+
"types": "./docs/types",
|
|
29
|
+
"scripts": {},
|
|
30
|
+
"homepage": "https://github.com/stdlib-js/stdlib",
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "git://github.com/stdlib-js/stdlib.git"
|
|
34
|
+
},
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {},
|
|
39
|
+
"devDependencies": {},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=0.10.0",
|
|
42
|
+
"npm": ">2.7.0"
|
|
43
|
+
},
|
|
44
|
+
"os": [
|
|
45
|
+
"aix",
|
|
46
|
+
"darwin",
|
|
47
|
+
"freebsd",
|
|
48
|
+
"linux",
|
|
49
|
+
"macos",
|
|
50
|
+
"openbsd",
|
|
51
|
+
"sunos",
|
|
52
|
+
"win32",
|
|
53
|
+
"windows",
|
|
54
|
+
"openharmony"
|
|
55
|
+
],
|
|
56
|
+
"keywords": [
|
|
57
|
+
"stdlib",
|
|
58
|
+
"stdutils",
|
|
59
|
+
"stdutil",
|
|
60
|
+
"utils",
|
|
61
|
+
"util",
|
|
62
|
+
"utilities",
|
|
63
|
+
"utility",
|
|
64
|
+
"process",
|
|
65
|
+
"getegid",
|
|
66
|
+
"getgid",
|
|
67
|
+
"posix",
|
|
68
|
+
"linux",
|
|
69
|
+
"darwin",
|
|
70
|
+
"effective",
|
|
71
|
+
"gid",
|
|
72
|
+
"group",
|
|
73
|
+
"identity",
|
|
74
|
+
"id"
|
|
75
|
+
]
|
|
76
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
|
|
3
|
+
@license Apache-2.0
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2018 The Stdlib Authors.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
|
|
19
|
+
-->
|
|
20
|
+
|
|
21
|
+
# geteuid
|
|
22
|
+
|
|
23
|
+
> Return the effective numeric user identity of the calling process.
|
|
24
|
+
|
|
25
|
+
<section class="usage">
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
var geteuid = require( '@stdlib/process/geteuid' );
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
#### geteuid()
|
|
34
|
+
|
|
35
|
+
Returns the effective numeric user identity of the calling process.
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
var id = geteuid();
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
</section>
|
|
42
|
+
|
|
43
|
+
<!-- /.usage -->
|
|
44
|
+
|
|
45
|
+
<section class="notes">
|
|
46
|
+
|
|
47
|
+
## Notes
|
|
48
|
+
|
|
49
|
+
- The function **only** returns an `integer` user identity on POSIX platforms. For all other platforms (e.g., Windows, browsers, and Android), the function returns `null`.
|
|
50
|
+
- See [geteuid(2)][geteuid].
|
|
51
|
+
|
|
52
|
+
</section>
|
|
53
|
+
|
|
54
|
+
<!-- /.notes -->
|
|
55
|
+
|
|
56
|
+
<section class="examples">
|
|
57
|
+
|
|
58
|
+
## Examples
|
|
59
|
+
|
|
60
|
+
<!-- eslint no-undef: "error" -->
|
|
61
|
+
|
|
62
|
+
```javascript
|
|
63
|
+
var geteuid = require( '@stdlib/process/geteuid' );
|
|
64
|
+
|
|
65
|
+
var uid = geteuid();
|
|
66
|
+
if ( uid === 0 ) {
|
|
67
|
+
console.log( 'Effectively running as root.' );
|
|
68
|
+
} else {
|
|
69
|
+
console.log( 'uid: %d', uid );
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
</section>
|
|
74
|
+
|
|
75
|
+
<!-- /.examples -->
|
|
76
|
+
|
|
77
|
+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
|
|
78
|
+
|
|
79
|
+
<section class="related">
|
|
80
|
+
|
|
81
|
+
* * *
|
|
82
|
+
|
|
83
|
+
## See Also
|
|
84
|
+
|
|
85
|
+
- <span class="package-name">[`@stdlib/process/getegid`][@stdlib/process/getegid]</span><span class="delimiter">: </span><span class="description">return the effective numeric group identity of a calling process.</span>
|
|
86
|
+
- <span class="package-name">[`@stdlib/process/getgid`][@stdlib/process/getgid]</span><span class="delimiter">: </span><span class="description">return the numeric group identity of a calling process.</span>
|
|
87
|
+
- <span class="package-name">[`@stdlib/process/getuid`][@stdlib/process/getuid]</span><span class="delimiter">: </span><span class="description">return the numeric user identity of a calling process.</span>
|
|
88
|
+
|
|
89
|
+
</section>
|
|
90
|
+
|
|
91
|
+
<!-- /.related -->
|
|
92
|
+
|
|
93
|
+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
94
|
+
|
|
95
|
+
<section class="links">
|
|
96
|
+
|
|
97
|
+
[geteuid]: http://man7.org/linux/man-pages/man2/geteuid.2.html
|
|
98
|
+
|
|
99
|
+
<!-- <related-links> -->
|
|
100
|
+
|
|
101
|
+
[@stdlib/process/getegid]: https://github.com/stdlib-js/process/tree/main/getegid
|
|
102
|
+
|
|
103
|
+
[@stdlib/process/getgid]: https://github.com/stdlib-js/process/tree/main/getgid
|
|
104
|
+
|
|
105
|
+
[@stdlib/process/getuid]: https://github.com/stdlib-js/process/tree/main/getuid
|
|
106
|
+
|
|
107
|
+
<!-- </related-links> -->
|
|
108
|
+
|
|
109
|
+
</section>
|
|
110
|
+
|
|
111
|
+
<!-- /.links -->
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
{{alias}}()
|
|
3
|
+
Returns the effective numeric user identity of the calling process.
|
|
4
|
+
|
|
5
|
+
The function only returns an effective user identity on POSIX platforms. For
|
|
6
|
+
all other platforms (e.g., Windows and Android), the function returns
|
|
7
|
+
`null`.
|
|
8
|
+
|
|
9
|
+
Returns
|
|
10
|
+
-------
|
|
11
|
+
id: integer|null
|
|
12
|
+
Effective numeric user identity.
|
|
13
|
+
|
|
14
|
+
Examples
|
|
15
|
+
--------
|
|
16
|
+
> var uid = {{alias}}()
|
|
17
|
+
|
|
18
|
+
See Also
|
|
19
|
+
--------
|
|
20
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2019 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// TypeScript Version: 4.1
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Returns the effective numeric user identity of the calling process.
|
|
23
|
+
*
|
|
24
|
+
* ## Notes
|
|
25
|
+
*
|
|
26
|
+
* - The function only returns an effective user identity on POSIX platforms. For all other platforms (e.g., Windows and Android), the function returns `null`.
|
|
27
|
+
*
|
|
28
|
+
* @returns effective numeric user identity or null
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* var uid = geteuid();
|
|
32
|
+
*/
|
|
33
|
+
declare function geteuid(): number | null;
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
// EXPORTS //
|
|
37
|
+
|
|
38
|
+
export = geteuid;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2019 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import geteuid = require( './index' );
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
// TESTS //
|
|
23
|
+
|
|
24
|
+
// The function returns a number or null...
|
|
25
|
+
{
|
|
26
|
+
geteuid(); // $ExpectType number | null
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// The compiler throws an error if the function is provided arguments...
|
|
30
|
+
{
|
|
31
|
+
geteuid( true ); // $ExpectError
|
|
32
|
+
geteuid( [], 123 ); // $ExpectError
|
|
33
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2018 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Return the effective numeric user identity of the calling process.
|
|
23
|
+
*
|
|
24
|
+
* @module @stdlib/process/geteuid
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* var geteuid = require( '@ohos-ports/stdlib-process/geteuid' );
|
|
28
|
+
*
|
|
29
|
+
* var uid = geteuid();
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
// MODULES //
|
|
33
|
+
|
|
34
|
+
var main = require( './main.js' );
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
// EXPORTS //
|
|
38
|
+
|
|
39
|
+
module.exports = main;
|