节点的模块度_节点操作系统模块

节点的模块度

Node modules are like libraries which help us perform specific tasks. Node.js is always considered powerful because it has a very large ecosystem of third-party modules.

节点模块就像库一样,可以帮助我们执行特定任务。 Node.js一直被认为功能强大,因为它具有非常庞大的第三方模块生态系统。

The OS module is a built-in module used to get information about the computer's operating system and other important information about a system.

OS模块是一个内置模块,用于获取有关计算机操作系统的信息以及有关系统的其他重要信息

Take Note! You should have Node js in your PC.

做记录! 您的PC中应该有Node js。

With Node.js already up and running, let's get started.

在Node.js已经启动并运行的情况下,让我们开始吧。

Now, let's get started.

现在,让我们开始吧。

The OS module is an object where we make use of it's various properties to get the information we desire.

OS模块是一个对象,我们可以利用它的各种属性来获取所需的信息。

For example, os.arch() gives us the operating system CPU architecture.

例如, os.arch()为我们提供了操作系统CPU体系结构

Below, we'll see how to get information about the computer's free memory, platform, architecture and host name on the console.

在下面,我们将看到如何在控制台上获取有关计算机的可用内存,平台,体系结构和主机名的信息。

Open a text editor and type the following code and save it with the file name app.js:

打开一个文本编辑器,输入以下代码,并将其保存为文件名app.js

const os = require('os'); // include the OS module

console.log("Platform: " + os.platform());
console.log("Architecture: " + os.arch());
console.log (" Free memory: "  + os.freemem() );
console.log("Host name: " + os.hostname());

Note: The file should be saved in your default Node.js directory.

注意:该文件应保存在默认的Node.js目录中。

Run the code by initiating the file at the command prompt like a regular Node.js file.

通过在命令提示符处启动文件(如常规Node.js文件)来运行代码。

Node OS module

翻译自: https://www.includehelp.com/node-js/node-os-module.aspx

节点的模块度

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值