Module os
Operating system and file system processing module
Instructions:
1var os = require('os');
Object
Service
Service Constructor, see Service
1Service os.Service;
Static function
hostname
Query the host name of the current operating environment
1static String os.hostname();
Return result:
- String, Return hostname
endianness
Query the byte order of the current CPU
1static String os.endianness();
Return result:
- String, Return byte order
type
Query the operating system name of the current running environment
1static String os.type();
Return result:
- String, Returns the system name
release
Query the operating system version of the current operating environment
1static String os.release();
Return result:
- String, Return version information
homedir
Query the current user directory
1static String os.homedir();
Return result:
- String, Return directory string
arch
Query the current cpu environment
1static String os.arch();
Return result:
- String, Returns the cpu type, possible results are'amd64','arm','arm64','ia32'
loadavg
Query the operating environment for 1 minute, 5 minutes, 15 minutes average load
1static Array os.loadavg();
Return result:
- Array, Returns an array containing three load data
totalmem
Query the total memory of the operating environment, in bytes
1static Long os.totalmem();
Return result:
- Long, Return memory data
freemem
Query the available memory of the operating environment, in bytes
1static Long os.freemem();
Return result:
- Long, Return memory data
cpus
Query the number and parameters of the current operating environment cpu
1static Array os.cpus();
Return result:
- Array, Returns an array containing cpu parameters, each item corresponds to a cpu
cpuNumbers
Query the number of CPUs in the current operating environment
1static Integer os.cpuNumbers();
Return result:
- Integer, Returns the number of cpu
tmpdir
Query the temporary file directory of the current operating environment
1static String os.tmpdir();
Return result:
- String, Return to the temporary file directory
userInfo
Return the current effective user information
1static Object os.userInfo(Object options = {});
Call parameters:
- options: Object, the character encoding used to interpret the result string
Return result:
- Object, Current effective execution user information
networkInterfaces
Query current operating environment network information
1static Object os.networkInterfaces();
Return result:
- Object, Return network card information
printerInfo
Query the printer information of the current host
1static Array os.printerInfo();
Return result:
- Array, Return printer information
openPrinter
Create a printer output object
1static BufferedStream os.openPrinter(String name) async;
Call parameters:
- name: String, printer name
Return result:
- BufferedStream, Returns the printer output object
platform
Query the current platform name
1static String os.platform();
Return result:
- String, Returns the platform name, possible results are'darwin','freebsd','linux', or'win32'
time
Parse the time string or query the current time of the runtime environment
1static Date os.time(String tmString = "");
Call parameters:
- tmString: String, time string, the current time is queried by default
Return result:
- Date, Returns the javascript Date object
dateAdd
Time calculation function, specify calculation time according to part
1
2
3static Date os.dateAdd(Date d,
Integer num,
String part);
Call parameters:
- d: Date, specifies the Date object used to calculate
- num: Integer, specify the value of the operation
- part: String, specify the time part of the operation, the received values are: "year", "month", "day", "hour", "minute", "second"
Return result:
- Date, Returns the javascript Date object
Static properties
timezone
Integer, query the current time zone of the operating environment
1static readonly Integer os.timezone;
EOL
String, query the end-of-line identifier of the current operating environment, posix:\"\n\"; windows:\"\r\n\"
1static readonly String os.EOL;