操作系统与文件系统处理模块
使用方法:
var os = require('os');
| Type | Method and Description |
|---|---|
| void | public static static ServiceServiceServiceService 构造函数,参见 Service |
| readonly String | public static readonly String hostnamehostnamehostname查询当前运行环境主机名 |
| readonly String | public static readonly String typetypetype查询当前运行环境操作系统名称 |
| readonly String | public static readonly String versionversionversion查询当前运行环境操作系统版本 |
| readonly String | public static readonly String archarcharch查询当前 cpu 环境,可能的结果为 ‘amd64’, ‘arm’, ‘arm64’, ‘ia32’ |
| readonly Integer | public static readonly Integer timezonetimezonetimezone查询运行环境当前时区 |
| readonly String | public static readonly String EOLEOLEOL查询当前运行环境行结尾标识,posix:”\n”;windows:”\r\n” |
| readonly String | public static readonly String execPathexecPathexecPath查询当前运行执行文件完整路径 |
| Type | Method and Description |
|---|---|
| Number | uptime()查询运行环境运行时间,以秒为单位 |
| Array | loadavg()查询运行环境 1分钟,5分钟,15分钟平均负载 |
| Long | totalmem()查询运行环境总内存,以字节为单位 |
| Long | freemem()查询运行环境可用内存,以字节为单位 |
| Array | CPUInfo()查询当前运行环境 cpu 个数和参数 |
| Integer | CPUs()查询当前运行环境 cpu 个数 |
| String | tmpdir()查询当前运行环境临时文件目录 |
| Object | networkInfo()查询当前运行环境网络信息 |
| Array | printerInfo()查询当前主机的打印机信息 |
| BufferedStream | openPrinter(String name)创建一个打印机输出对象 |
| String | platform()查询当前平台名称,可能的结果为 ‘darwin’, ‘freebsd’, ‘linux’, 或 ‘win32’ |
| Date | time(String tmString)解析时间字符串或查询运行环境当前时间 |
| Date | dateAdd(Date d,Integer num,String part)时间计算函数,根据 part 指定计算时间 |
| Object | memoryUsage()查询当前进程内存使用报告 |
public static static ServiceServiceServiceService 构造函数,参见 Service
public static readonly String hostnamehostnamehostname查询当前运行环境主机名
public static readonly String typetypetype查询当前运行环境操作系统名称
public static readonly String versionversionversion查询当前运行环境操作系统版本
public static readonly String archarcharch查询当前 cpu 环境,可能的结果为 ‘amd64’, ‘arm’, ‘arm64’, ‘ia32’
public static readonly Integer timezonetimezonetimezone查询运行环境当前时区
public static readonly String EOLEOLEOL查询当前运行环境行结尾标识,posix:”\n”;windows:”\r\n”
public static readonly String execPathexecPathexecPath查询当前运行执行文件完整路径
uptime()查询运行环境运行时间,以秒为单位
返回表示时间的数值
loadavg()查询运行环境 1分钟,5分钟,15分钟平均负载
返回包含三个负载数据的数组
totalmem()查询运行环境总内存,以字节为单位
返回内存数据
freemem()查询运行环境可用内存,以字节为单位
返回内存数据
CPUInfo()查询当前运行环境 cpu 个数和参数
返回包含 cpu 参数的数组,每一项对应一个 cpu
CPUs()查询当前运行环境 cpu 个数
返回 cpu 个数
tmpdir()查询当前运行环境临时文件目录
返回临时文件目录
networkInfo()查询当前运行环境网络信息
返回网卡信息
printerInfo()查询当前主机的打印机信息
返回打印机信息
openPrinter(String name)创建一个打印机输出对象
name 打印机名称返回打印机输出对象
platform()查询当前平台名称,可能的结果为 ‘darwin’, ‘freebsd’, ‘linux’, 或 ‘win32’
time(String tmString)解析时间字符串或查询运行环境当前时间
tmString 时间字符串,缺省则查询当前时间返回 javascript Date 对象
dateAdd(Date d,Integer num,String part)时间计算函数,根据 part 指定计算时间
d 指定用于计算 Date 对象
num 指定运算的数值
part 指定运算的时间部位,接收值为:”year”, “month”, “day”, “hour”, “minute”, “second”
返回 javascript Date 对象
memoryUsage()查询当前进程内存使用报告
返回包含内存报告
内存报告生成类似以下结果:
{
"rss": 8622080,
"heapTotal": 4083456,
"heapUsed": 1621800,
"nativeObjects": 122
}
其中:
rss 返回进程当前占用物理内存大小
heapTotal 返回 v8 引擎堆内存大小
heapUsed 返回 v8 引擎正在使用堆内存大小
nativeObjects 返回当前有效内置对象数