process是全局对象,在任何地方都可以访问,而且它是EventEmitter的一个实例(关于EventEmitter后面会提到). process对象对一些标准的输入输出流进行了封装,如stdin(标准输入).stdout(标准输出)和stderr(标准错误输出).其中,stdin和stdout支持异步操作,前者可读,后者可写.stderr是一个同步可阻塞流. 使用stdin和stdout来读取和写入数据: process.stdin.setEncoding('utf-8'); proces
1.node.js事件循环 node.js事件可以继续插入事件,如果有事件就继续执行下去,每一次事件处理结束后等待下一个事件的发生:没有要处理的事件了,那整个就结束了; setTimeout插入一个 计时器事件,时间单位为毫秒; // 插入一个事件,让它多长(毫秒)时间以后执行一次 setTimeout(function() { console.log("set time out"); }, 3 * 1000); //3秒后执行显示 set time out setIn
Process模块 (Features of Process) process is a global variable which indicates the current Node.js process. It is actually an instance of EventEmiter, which is used to subscribe events and emit messages to specific events, for more information, you may