linfeimy / Node.js-Demo

Node.js相关学习记录
0 stars 0 forks source link

os模块 #5

Open linfeimy opened 5 years ago

linfeimy commented 5 years ago
const os = require('os');
console.log(os);
{
    arch: { [Function: arch][Symbol(Symbol.toPrimitive)] : [Function]
    },
    cpus: [Function: cpus],
    endianness: { [Function: endianness][Symbol(Symbol.toPrimitive)] : [Function]
    },
    freemem: { [Function: getFreeMem][Symbol(Symbol.toPrimitive)] : [Function]
    },
    getPriority: [Function: getPriority],
    homedir: { [Function: checkError][Symbol(Symbol.toPrimitive)] : [Function]
    },
    hostname: { [Function: checkError][Symbol(Symbol.toPrimitive)] : [Function]
    },
    loadavg: [Function: loadavg],
    networkInterfaces: [Function: networkInterfaces],
    platform: { [Function: platform][Symbol(Symbol.toPrimitive)] : [Function]
    },
    release: { [Function: checkError][Symbol(Symbol.toPrimitive)] : [Function]
    },
    setPriority: [Function: setPriority],
    tmpdir: { [Function: tmpdir][Symbol(Symbol.toPrimitive)] : [Function]
    },
    totalmem: { [Function: getTotalMem][Symbol(Symbol.toPrimitive)] : [Function]
    },
    type: { [Function: checkError][Symbol(Symbol.toPrimitive)] : [Function]
    },
    userInfo: [Function: userInfo],
    uptime: { [Function: getUptime][Symbol(Symbol.toPrimitive)] : [Function]
    },
    getNetworkInterfaces: [Function: deprecated],
    tmpDir: [Function: deprecated],
    constants: [Object: null prototype] {
        UV_UDP_REUSEADDR: 4,
        dlopen: [Object: null prototype] {},
        errno: [Object: null prototype] {
            E2BIG: 7,
            EACCES: 13,
            EADDRINUSE: 100,
            EADDRNOTAVAIL: 101,
            EAFNOSUPPORT: 102,
            EAGAIN: 11,
            EALREADY: 103,
            EBADF: 9,
            EBADMSG: 104,
            EBUSY: 16,
            ECANCELED: 105,
            ECHILD: 10,
            ECONNABORTED: 106,
            ECONNREFUSED: 107,
            ECONNRESET: 108,
            EDEADLK: 36,
            EDESTADDRREQ: 109,
            EDOM: 33,
            EEXIST: 17,
            EFAULT: 14,
            EFBIG: 27,
            EHOSTUNREACH: 110,
            EIDRM: 111,
            EILSEQ: 42,
            EINPROGRESS: 112,
            EINTR: 4,
            EINVAL: 22,
            EIO: 5,
            EISCONN: 113,
            EISDIR: 21,
            ELOOP: 114,
            EMFILE: 24,
            EMLINK: 31,
            EMSGSIZE: 115,
            ENAMETOOLONG: 38,
            ENETDOWN: 116,
            ENETRESET: 117,
            ENETUNREACH: 118,
            ENFILE: 23,
            ENOBUFS: 119,
            ENODATA: 120,
            ENODEV: 19,
            ENOENT: 2,
            ENOEXEC: 8,
            ENOLCK: 39,
            ENOLINK: 121,
            ENOMEM: 12,
            ENOMSG: 122,
            ENOPROTOOPT: 123,
            ENOSPC: 28,
            ENOSR: 124,
            ENOSTR: 125,
            ENOSYS: 40,
            ENOTCONN: 126,
            ENOTDIR: 20,
            ENOTEMPTY: 41,
            ENOTSOCK: 128,
            ENOTSUP: 129,
            ENOTTY: 25,
            ENXIO: 6,
            EOPNOTSUPP: 130,
            EOVERFLOW: 132,
            EPERM: 1,
            EPIPE: 32,
            EPROTO: 134,
            EPROTONOSUPPORT: 135,
            EPROTOTYPE: 136,
            ERANGE: 34,
            EROFS: 30,
            ESPIPE: 29,
            ESRCH: 3,
            ETIME: 137,
            ETIMEDOUT: 138,
            ETXTBSY: 139,
            EWOULDBLOCK: 140,
            EXDEV: 18,
            WSAEINTR: 10004,
            WSAEBADF: 10009,
            WSAEACCES: 10013,
            WSAEFAULT: 10014,
            WSAEINVAL: 10022,
            WSAEMFILE: 10024,
            WSAEWOULDBLOCK: 10035,
            WSAEINPROGRESS: 10036,
            WSAEALREADY: 10037,
            WSAENOTSOCK: 10038,
            WSAEDESTADDRREQ: 10039,
            WSAEMSGSIZE: 10040,
            WSAEPROTOTYPE: 10041,
            WSAENOPROTOOPT: 10042,
            WSAEPROTONOSUPPORT: 10043,
            WSAESOCKTNOSUPPORT: 10044,
            WSAEOPNOTSUPP: 10045,
            WSAEPFNOSUPPORT: 10046,
            WSAEAFNOSUPPORT: 10047,
            WSAEADDRINUSE: 10048,
            WSAEADDRNOTAVAIL: 10049,
            WSAENETDOWN: 10050,
            WSAENETUNREACH: 10051,
            WSAENETRESET: 10052,
            WSAECONNABORTED: 10053,
            WSAECONNRESET: 10054,
            WSAENOBUFS: 10055,
            WSAEISCONN: 10056,
            WSAENOTCONN: 10057,
            WSAESHUTDOWN: 10058,
            WSAETOOMANYREFS: 10059,
            WSAETIMEDOUT: 10060,
            WSAECONNREFUSED: 10061,
            WSAELOOP: 10062,
            WSAENAMETOOLONG: 10063,
            WSAEHOSTDOWN: 10064,
            WSAEHOSTUNREACH: 10065,
            WSAENOTEMPTY: 10066,
            WSAEPROCLIM: 10067,
            WSAEUSERS: 10068,
            WSAEDQUOT: 10069,
            WSAESTALE: 10070,
            WSAEREMOTE: 10071,
            WSASYSNOTREADY: 10091,
            WSAVERNOTSUPPORTED: 10092,
            WSANOTINITIALISED: 10093,
            WSAEDISCON: 10101,
            WSAENOMORE: 10102,
            WSAECANCELLED: 10103,
            WSAEINVALIDPROCTABLE: 10104,
            WSAEINVALIDPROVIDER: 10105,
            WSAEPROVIDERFAILEDINIT: 10106,
            WSASYSCALLFAILURE: 10107,
            WSASERVICE_NOT_FOUND: 10108,
            WSATYPE_NOT_FOUND: 10109,
            WSA_E_NO_MORE: 10110,
            WSA_E_CANCELLED: 10111,
            WSAEREFUSED: 10112
        },
        signals: [Object: null prototype] {
            SIGHUP: 1,
            SIGINT: 2,
            SIGILL: 4,
            SIGABRT: 22,
            SIGFPE: 8,
            SIGKILL: 9,
            SIGSEGV: 11,
            SIGTERM: 15,
            SIGBREAK: 21,
            SIGWINCH: 28
        },
        priority: [Object: null prototype] {
            PRIORITY_LOW: 19,
            PRIORITY_BELOW_NORMAL: 10,
            PRIORITY_NORMAL: 0,
            PRIORITY_ABOVE_NORMAL: -7,
            PRIORITY_HIGH: -14,
            PRIORITY_HIGHEST: -20
        }
    },
    EOL: '\r\n'
}
linfeimy commented 5 years ago
console.log(os.arch()); // x64
console.log(os.cpus());
console.log(os.endianness()); // LE
console.log(os.freemem()); // 1853276160
console.log(os.getPriority()); // 0
console.log(os.homedir()); // C:\Users\qian0
console.log(os.hostname()); // DESKTOP-O11HVTS
console.log(os.loadavg()); // [ 0, 0, 0 ]
console.log(os.networkInterfaces());
console.log(os.platform()); // win32
console.log(os.release()); // 10.0.18362
console.log(os.setPriority(0)); // undefined
console.log(os.tmpdir()); // C:\Users\qian0\AppData\Local\Temp
console.log(os.totalmem()); // 8546934784
console.log(os.type()); // Windows_NT
console.log(os.userInfo());
console.log(os.uptime()); // 589797
console.log(os.getNetworkInterface);
console.log(os.tmpDir()); // (node:17436) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
console.log(os.constants);
console.log(os.signals); // undefined
console.log(os.priority); // undefined
console.log( os.EOL ); // \r\n
console.log('Hello World!'); // Hello World!
console.log('Hello ' + os.EOL + 'World!');