18. node process 객체
console.log(process);
// {
// version: 'v19.7.0',
// versions: {
// node: '19.7.0',
// acorn: '8.8.2',
// ada: '1.0.1',
// ares: '1.19.0',
// brotli: '1.0.9',
// cldr: '42.0',
// icu: '72.1',
// llhttp: '8.1.0',
// modules: '111',
// napi: '8',
// nghttp2: '1.52.0',
// openssl: '1.1.1t',
// simdutf: '3.1.0',
// tz: '2022e',
// undici: '5.20.0',
// unicode: '15.0',
// uv: '1.44.2',
// uvwasi: '0.0.15',
// v8: '10.8.168.25-node.11',
// zlib: '1.2.11'
// },
// arch: 'arm64',
// platform: 'darwin',
// release: {
// name: 'node',
// sourceUrl: 'https://nodejs.org/download/release/v19.7.0/node-v19.7.0.tar.gz',
// headersUrl: 'https://nodejs.org/download/release/v19.7.0/node-v19.7.0-headers.tar.gz'
// },
// _rawDebug: [Function: _rawDebug],
// moduleLoadList: [
// 'Internal Binding builtins',
// 'Internal Binding errors',
// 'Internal Binding util',
// 'NativeModule internal/errors',
// 'Internal Binding config',
// 'Internal Binding timers',
// 'Internal Binding async_wrap',
// 'Internal Binding task_queue',
// 'Internal Binding symbols',
// 'NativeModule internal/async_hooks',
// 'Internal Binding constants',
// 'Internal Binding types',
// 'NativeModule internal/util',
// 'NativeModule internal/util/types',
// 'NativeModule internal/validators',
// 'NativeModule internal/linkedlist',
// 'NativeModule internal/priority_queue',
// 'NativeModule internal/assert',
// 'Internal Binding icu',
// 'NativeModule internal/util/inspect',
// 'NativeModule internal/util/debuglog',
// 'NativeModule internal/timers',
// 'NativeModule events',
// 'Internal Binding buffer',
// 'Internal Binding string_decoder',
// 'NativeModule internal/buffer',
// 'NativeModule buffer',
// 'Internal Binding messaging',
// 'NativeModule internal/worker/js_transferable',
// 'Internal Binding process_methods',
// 'NativeModule internal/process/per_thread',
// 'Internal Binding credentials',
// 'NativeModule internal/process/promises',
// 'NativeModule internal/fixed_queue',
// 'NativeModule async_hooks',
// 'NativeModule internal/process/task_queues',
// 'NativeModule timers',
// 'Internal Binding trace_events',
// 'NativeModule internal/constants',
// 'NativeModule path',
// 'NativeModule internal/process/execution',
// 'NativeModule internal/process/warning',
// 'NativeModule internal/console/constructor',
// 'NativeModule internal/console/global',
// 'NativeModule internal/util/inspector',
// 'Internal Binding inspector',
// 'NativeModule internal/querystring',
// 'NativeModule querystring',
// 'Internal Binding url',
// 'Internal Binding blob',
// 'NativeModule internal/url',
// 'NativeModule util',
// 'Internal Binding performance',
// 'NativeModule internal/perf/utils',
// 'NativeModule internal/event_target',
// 'Internal Binding mksnapshot',
// 'NativeModule internal/v8/startup_snapshot',
// 'NativeModule internal/process/signal',
// 'Internal Binding fs',
// 'NativeModule internal/fs/utils',
// 'NativeModule fs',
// 'NativeModule internal/idna',
// 'NativeModule url',
// 'Internal Binding options',
// 'NativeModule internal/options',
// 'NativeModule internal/source_map/source_map_cache',
// 'Internal Binding contextify',
// 'NativeModule internal/vm',
// 'NativeModule internal/modules/helpers',
// 'NativeModule internal/modules/package_json_reader',
// 'Internal Binding module_wrap',
// 'NativeModule internal/modules/cjs/loader',
// 'NativeModule internal/vm/module',
// 'NativeModule internal/modules/esm/utils',
// 'NativeModule internal/inspector_async_hook',
// 'Internal Binding wasm_web_api',
// 'Internal Binding worker',
// 'NativeModule internal/modules/run_main',
// 'NativeModule internal/net',
// 'NativeModule internal/dns/utils',
// 'NativeModule internal/process/pre_execution',
// 'NativeModule internal/abort_controller',
// 'NativeModule internal/streams/utils',
// 'NativeModule internal/streams/end-of-stream',
// 'NativeModule internal/streams/destroy',
// 'NativeModule internal/streams/legacy',
// 'NativeModule internal/streams/add-abort-signal',
// 'NativeModule internal/streams/buffer_list',
// 'NativeModule internal/streams/state',
// 'NativeModule string_decoder',
// 'NativeModule internal/streams/from',
// 'NativeModule internal/streams/readable',
// 'NativeModule internal/streams/writable',
// 'NativeModule internal/streams/duplex',
// 'NativeModule internal/streams/pipeline',
// 'NativeModule internal/streams/compose',
// 'NativeModule internal/streams/operators',
// 'NativeModule stream/promises',
// 'NativeModule internal/streams/transform',
// 'NativeModule internal/streams/passthrough',
// ... 14 more items
// ],
// binding: [Function: binding],
// _linkedBinding: [Function: _linkedBinding],
// _events: [Object: null prototype] {
// newListener: [Function: startListeningIfSignal],
// removeListener: [Function: stopListeningIfSignal],
// warning: [Function: onWarning],
// SIGWINCH: [Function: refreshStdoutOnSigWinch]
// },
// _eventsCount: 4,
// _maxListeners: undefined,
// domain: null,
// _exiting: [Getter/Setter],
// exitCode: [Getter/Setter],
// config: {
// target_defaults: {
// cflags: [Array],
// default_configuration: 'Release',
// defines: [Array],
// include_dirs: [Array],
// libraries: [Array]
// },
// variables: {
// arm_fpu: 'neon',
// asan: 0,
// coverage: false,
// dcheck_always_on: 0,
// debug_nghttp2: false,
// debug_node: false,
// enable_lto: true,
// enable_pgo_generate: false,
// enable_pgo_use: false,
// error_on_warn: false,
// force_dynamic_crt: 0,
// host_arch: 'arm64',
// icu_gyp_path: 'tools/icu/icu-system.gyp',
// icu_small: false,
// icu_ver_major: '72',
// is_debug: 0,
// libdir: 'lib',
// llvm_version: '14.0',
// napi_build_version: '8',
// node_builtin_shareable_builtins: [Array],
// node_byteorder: 'little',
// node_debug_lib: false,
// node_enable_d8: false,
// node_enable_v8_vtunejit: false,
// node_fipsinstall: false,
// node_install_corepack: false,
// node_install_npm: false,
// node_library_files: [Array],
// node_module_version: 111,
// node_no_browser_globals: false,
// node_prefix: '/opt/homebrew/Cellar/node/19.7.0',
// node_release_urlbase: '',
// node_shared: false,
// node_shared_brotli: true,
// node_shared_cares: true,
// node_shared_http_parser: false,
// node_shared_libuv: true,
// node_shared_nghttp2: true,
// node_shared_nghttp3: false,
// node_shared_ngtcp2: false,
// node_shared_openssl: true,
// node_shared_zlib: true,
// node_tag: '',
// node_target_type: 'executable',
// node_use_bundled_v8: true,
// node_use_node_code_cache: true,
// node_use_node_snapshot: true,
// node_use_openssl: true,
// node_use_v8_platform: true,
// node_with_ltcg: false,
// node_without_node_options: false,
// openssl_is_fips: false,
// openssl_quic: false,
// ossfuzz: false,
// shlib_suffix: '111.dylib',
// single_executable_application: true,
// target_arch: 'arm64',
// v8_enable_31bit_smis_on_64bit_arch: 0,
// v8_enable_gdbjit: 0,
// v8_enable_hugepage: 0,
// v8_enable_i18n_support: 1,
// v8_enable_inspector: 1,
// v8_enable_javascript_promise_hooks: 1,
// v8_enable_lite_mode: 0,
// v8_enable_object_print: 1,
// v8_enable_pointer_compression: 0,
// v8_enable_shared_ro_heap: 1,
// v8_enable_webassembly: 1,
// v8_no_strict_aliasing: 1,
// v8_optimized_debug: 1,
// v8_promise_internal_field_count: 1,
// v8_random_seed: 0,
// v8_trace_maps: 0,
// v8_use_siphash: 1,
// want_separate_host_toolset: 0
// }
// },
// dlopen: [Function: dlopen],
// uptime: [Function: uptime],
// _getActiveRequests: [Function: _getActiveRequests],
// _getActiveHandles: [Function: _getActiveHandles],
// getActiveResourcesInfo: [Function: getActiveResourcesInfo],
// reallyExit: [Function: reallyExit],
// _kill: [Function: _kill],
// cpuUsage: [Function: cpuUsage],
// resourceUsage: [Function: resourceUsage],
// memoryUsage: [Function: memoryUsage] { rss: [Function: rss] },
// constrainedMemory: [Function: constrainedMemory],
// kill: [Function: kill],
// exit: [Function: exit],
// hrtime: [Function: hrtime] { bigint: [Function: hrtimeBigInt] },
// openStdin: [Function (anonymous)],
// getuid: [Function: getuid],
// geteuid: [Function: geteuid],
// getgid: [Function: getgid],
// getegid: [Function: getegid],
// getgroups: [Function: getgroups],
// allowedNodeEnvironmentFlags: [Getter/Setter],
// assert: [Function: deprecated],
// features: {
// inspector: true,
// debug: false,
// uv: true,
// ipv6: true,
// tls_alpn: true,
// tls_sni: true,
// tls_ocsp: true,
// tls: true,
// cached_builtins: [Getter]
// },
// _fatalException: [Function (anonymous)],
// setUncaughtExceptionCaptureCallback: [Function: setUncaughtExceptionCaptureCallback],
// hasUncaughtExceptionCaptureCallback: [Function: hasUncaughtExceptionCaptureCallback],
// emitWarning: [Function: emitWarning],
// nextTick: [Function: nextTick],
// _tickCallback: [Function: runNextTicks],
// _debugProcess: [Function: _debugProcess],
// _debugEnd: [Function: _debugEnd],
// _startProfilerIdleNotifier: [Function (anonymous)],
// _stopProfilerIdleNotifier: [Function (anonymous)],
// stdout: [Getter],
// stdin: [Getter],
// stderr: [Getter],
// abort: [Function: abort],
// umask: [Function: wrappedUmask],
// chdir: [Function: wrappedChdir],
// cwd: [Function: wrappedCwd],
// initgroups: [Function: initgroups],
// setgroups: [Function: setgroups],
// setegid: [Function (anonymous)],
// seteuid: [Function (anonymous)],
// setgid: [Function (anonymous)],
// setuid: [Function (anonymous)],
// env: {
// PATH: '/Users/xxxx/anaconda3/bin:/Users/xxxx/anaconda3/condabin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin',
// __CFBundleIdentifier: 'com.jetbrains.intellij',
// SHELL: '/bin/zsh',
// TERM: 'xterm-256color',
// USER: 'xxxx',
// TMPDIR: '/var/folders/6p/64fw19cj2jg8j24xggqn7lcc0000gn/T/',
// COMMAND_MODE: 'unix2003',
// TERMINAL_EMULATOR: 'JetBrains-JediTerm',
// SSH_AUTH_SOCK: '/private/tmp/com.apple.launchd.RU4eOZf13I/Listeners',
// DISPLAY: '/private/tmp/com.apple.launchd.DU1JRrhfsd/org.macosforge.xquartz:0',
// XPC_FLAGS: '0x0',
// TERM_SESSION_ID: '6178959c-6563-490f-9e96-1044a15a1bd7',
// __CF_USER_TEXT_ENCODING: '0x1F5:0x3:0x33',
// LOGNAME: 'xxxx',
// LC_CTYPE: 'UTF-8',
// XPC_SERVICE_NAME: '0',
// HOME: '/Users/xxxx',
// SHLVL: '1',
// PWD: '/Users/xxxx/total/server/node/202305ing_node_study/section_3/3_6_process',
// OLDPWD: '/Users/xxxx/total/server/node/202305ing_node_study/section_3/3_5_glabal_console_timer',
// NVM_DIR: '/Users/xxxx/.nvm',
// NVM_CD_FLAGS: '-q',
// NVM_BIN: '/Users/xxxx/.nvm/versions/node/v14.17.6/bin',
// NVM_INC: '/Users/xxxx/.nvm/versions/node/v14.17.6/include/node',
// CONDA_EXE: '/Users/xxxx/anaconda3/bin/conda',
// _CE_M: '',
// _CE_CONDA: '',
// CONDA_PYTHON_EXE: '/Users/xxxx/anaconda3/bin/python',
// CONDA_SHLVL: '1',
// CONDA_PREFIX: '/Users/xxxx/anaconda3',
// CONDA_DEFAULT_ENV: 'base',
// CONDA_PROMPT_MODIFIER: '(base) ',
// _: '/opt/homebrew/bin/node'
// },
// title: 'node',
// argv: [
// '/opt/homebrew/Cellar/node/19.7.0/bin/node',
// '/Users/xxxx/total/server/node/202305ing_node_study/section_3/3_6_process/3_6_1_process.js'
// ],
// execArgv: [],
// pid: 55222,
// ppid: 52278,
// execPath: '/opt/homebrew/Cellar/node/19.7.0/bin/node',
// debugPort: 9229,
// argv0: 'node',
// _preload_modules: [],
// report: [Getter],
// setSourceMapsEnabled: [Function: setSourceMapsEnabled],
// mainModule: Module {
// id: '.',
// path: '/Users/xxxx/total/server/node/202305ing_node_study/section_3/3_6_process',
// exports: {},
// filename: '/Users/xxxx/total/server/node/202305ing_node_study/section_3/3_6_process/3_6_1_process.js',
// loaded: false,
// children: [],
// paths: [
// '/Users/xxxx/total/server/node/202305ing_node_study/section_3/3_6_process/node_modules',
// '/Users/xxxx/total/server/node/202305ing_node_study/section_3/node_modules',
// '/Users/xxxx/total/server/node/202305ing_node_study/node_modules',
// '/Users/xxxx/total/server/node/node_modules',
// '/Users/xxxx/total/server/node_modules',
// '/Users/xxxx/total/node_modules',
// '/Users/xxxx/node_modules',
// '/Users/node_modules',
// '/node_modules'
// ]
// },
// [Symbol(kCapture)]: false
// }
// m1 macbook pro 기준
console.log(process.version); // v19.7.0 // 설치된 노드 버전
console.log(process.arch); // arm64 // 프로세서 아키텍처 정보 // arm, ia32 등의 값일 수 있음
console.log(process.platform); // darwin // 운영체제 플랫폼 정보 // linux, darwin, freebsd 등의 값일 수 있음
console.log(process.pid); // 55530 // 현재 프로세스 아이디 // 프로세스를 여러개 가질 때 구분할 수 있음 // 강제종료시 많이 쓰임
console.log(process.uptime()); // 0.035099666 // 프로세스가 시작된 후 흐른 시간, 단위는 초 // 5분 후에 자동으로 종료되게 설정 가능
console.log(process.execPath); // /opt/homebrew/Cellar/node/19.7.0/bin/node // 노드의 경로
console.log(process.cwd()); // /Users/.../total/server/node/202305ing_node_study/section_3/3_6_process // 현재 프로세스가 실행되는 위치
console.log(process.cpuUsage()); // { user: 25940, system: 25711 } // 현재 cpu 사용량