/
os.idl
148 lines (121 loc) · 4.19 KB
/
os.idl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*! @brief 操作系统与文件系统处理模块
使用方法:
```JavaScript
var os = require('os');
```
*/
module os
{
/*! @brief Service 构造函数,参见 Service */
static Service;
/*! @brief 查询当前运行环境主机名
@return 返回主机名
*/
static String hostname();
/*! @brief 查询当前 CPU 的字节顺序
@return 返回字节顺序
*/
static String endianness();
/*! @brief 查询当前运行环境操作系统名称
@return 返回系统名称
*/
static String type();
/*! @brief 查询当前运行环境操作系统版本
@return 返回版本信息
*/
static String release();
/*! @brief 查询当前用户目录
@return 返回目录字符串
*/
static String homedir();
/*! @brief 查询当前 cpu 环境
@return 返回 cpu 类型,可能的结果为 'amd64', 'arm', 'arm64', 'ia32'
*/
static String arch();
/*! @brief 查询运行环境当前时区 */
static readonly Integer timezone;
/*! @brief 查询当前运行环境行结尾标识,posix:\"\\n\";windows:\"\\r\\n\" */
static readonly String EOL;
/*! @brief 查询运行环境运行时间,以秒为单位
@return 返回表示时间的数值
*/
static Number uptime();
/*! @brief 查询运行环境 1分钟,5分钟,15分钟平均负载
@return 返回包含三个负载数据的数组
*/
static Array loadavg();
/*! @brief 查询运行环境总内存,以字节为单位
@return 返回内存数据
*/
static Long totalmem();
/*! @brief 查询运行环境可用内存,以字节为单位
@return 返回内存数据
*/
static Long freemem();
/*! @brief 查询当前运行环境 cpu 个数和参数
@return 返回包含 cpu 参数的数组,每一项对应一个 cpu
*/
static Array cpus();
/*! @brief 查询当前运行环境 cpu 个数
@return 返回 cpu 个数
*/
static Integer cpuNumbers();
/*! @brief 查询当前运行环境临时文件目录
@return 返回临时文件目录
*/
static String tmpdir();
/*! @brief 返回当前有效执行用户信息
@param options 用于解释结果字符串的字符编码
@return 当前有效执行用户信息
*/
static Object userInfo(Object options = {});
/*! @brief 查询当前运行环境网络信息
@return 返回网卡信息
*/
static Object networkInterfaces();
/*! @brief 查询当前主机的打印机信息
@return 返回打印机信息
*/
static Array printerInfo();
/*! @brief 创建一个打印机输出对象
@param name 打印机名称
@return 返回打印机输出对象
*/
static BufferedStream openPrinter(String name) async;
/*! @brief 查询当前平台名称
@return 返回平台名称,可能的结果为 'darwin', 'freebsd', 'linux', 或 'win32'
*/
static String platform();
/*! @brief 解析时间字符串或查询运行环境当前时间
@param tmString 时间字符串,缺省则查询当前时间
@return 返回 javascript Date 对象
*/
static Date time(String tmString = "");
/*! @brief 时间计算函数,根据 part 指定计算时间
@param d 指定用于计算 Date 对象
@param num 指定运算的数值
@param part 指定运算的时间部位,接收值为:"year", "month", "day", "hour", "minute", "second"
@return 返回 javascript Date 对象
*/
static Date dateAdd(Date d, Integer num, String part);
/*! @brief 查询当前运行执行文件完整路径 */
static readonly String execPath;
/*! @brief 查询当前进程内存使用报告
内存报告生成类似以下结果:
```JavaScript
{
"rss": 8622080,
"heapTotal": 4083456,
"heapUsed": 1621800,
"nativeObjects": 122
}
```
其中:
- rss 返回进程当前占用物理内存大小
- heapTotal 返回 v8 引擎堆内存大小
- heapUsed 返回 v8 引擎正在使用堆内存大小
- nativeObjects 返回当前有效内置对象数
@return 返回包含内存报告
*/
static Object memoryUsage();
};