@camjn/getargv 0.0.31 → 0.0.32
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.txt +1 -1
- package/dist/binding.d.ts +1 -1
- package/dist/binding.js +21 -33
- package/dist/cli.js +2 -1
- package/package.json +1 -1
package/LICENSE.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
BSD 3-Clause License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2022, 2023, 2024 Camden Narzt <getargv@narzt.cam>. All rights reserved.
|
|
3
|
+
Copyright (c) 2022, 2023, 2024, 2025 Camden Narzt <getargv@narzt.cam>. All rights reserved.
|
|
4
4
|
|
|
5
5
|
Redistribution and use in source and binary forms, with or without
|
|
6
6
|
modification, are permitted provided that the following conditions are met:
|
package/dist/binding.d.ts
CHANGED
package/dist/binding.js
CHANGED
|
@@ -1,43 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const addon = require('../build/Release/getargv_native.node');
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
function validate_args(target) {
|
|
4
|
+
return function (...args) {
|
|
5
|
+
if (arguments.length == 0)
|
|
6
|
+
throw new TypeError('The "pid" argument must be specified');
|
|
7
|
+
if (arguments.length == 1)
|
|
8
|
+
throw new TypeError('The "encoding" argument must be specified');
|
|
9
|
+
const [pid, encoding] = arguments;
|
|
10
|
+
if (typeof pid !== "number") {
|
|
11
|
+
throw new TypeError('The "pid" argument must be a number');
|
|
12
|
+
}
|
|
13
|
+
if (typeof encoding !== "string") {
|
|
14
|
+
throw new TypeError(`The "encoding" argument must be a string, is a: ${typeof encoding}`);
|
|
15
|
+
}
|
|
16
|
+
return target.apply(this, args);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
addon.as_string = validate_args(function (pid, encoding, nuls = false, skip = 0, options) {
|
|
19
20
|
const decoder = new TextDecoder(encoding, options);
|
|
20
|
-
const array = addon.get_argv_of_pid(pid, nuls
|
|
21
|
+
const array = addon.get_argv_of_pid(pid, nuls, skip);
|
|
21
22
|
return decoder.decode(array);
|
|
22
|
-
};
|
|
23
|
-
addon.as_array = function
|
|
24
|
-
switch (arguments.length) {
|
|
25
|
-
case 0: throw new TypeError('The "pid" argument must be specified');
|
|
26
|
-
case 1: throw new TypeError('The "encoding" argument must be specified');
|
|
27
|
-
case 2:
|
|
28
|
-
case 3: break;
|
|
29
|
-
default: throw new TypeError('Too many arguments were specified');
|
|
30
|
-
}
|
|
31
|
-
if (typeof pid !== "number") {
|
|
32
|
-
throw new TypeError('The "pid" argument must be a number');
|
|
33
|
-
}
|
|
34
|
-
if (typeof encoding !== "string") {
|
|
35
|
-
throw new TypeError(`The "encoding" argument must be a string, is a: ${typeof encoding}`);
|
|
36
|
-
}
|
|
23
|
+
});
|
|
24
|
+
addon.as_array = validate_args(function (pid, encoding, options) {
|
|
37
25
|
const decoder = new TextDecoder(encoding, options);
|
|
38
26
|
const array = addon.get_argv_and_argc_of_pid(pid);
|
|
39
27
|
return array.map(b => decoder.decode(b));
|
|
40
|
-
};
|
|
28
|
+
});
|
|
41
29
|
exports.PID_MAX = addon.PID_MAX;
|
|
42
30
|
exports.ARG_MAX = addon.ARG_MAX;
|
|
43
31
|
exports.get_argv_of_pid = addon.get_argv_of_pid;
|
package/dist/cli.js
CHANGED
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"name": "@camjn/getargv",
|
|
19
19
|
"homepage": "https://getargv.narzt.cam/",
|
|
20
20
|
"author": "Camden Narzt <getargv@narzt.cam>",
|
|
21
|
-
"version": "0.0.
|
|
21
|
+
"version": "0.0.32",
|
|
22
22
|
"description": "This library allows you to query the arguments of other processes on macOS.",
|
|
23
23
|
"main": "dist/binding.js",
|
|
24
24
|
"scripts": {
|