Sometimes, we want to get number of processors available with Node.js.
In this article, we’ll look at how to get number of processors available with Node.js.
How to get number of processors available with Node.js?
To get number of processors available with Node.js, we can use the os.cpus
method.
For instance, we write
const os = require("os");
const cpuCount = os.cpus().length;
to get the cpuCount
with os.cpus().length
.
Conclusion
To get number of processors available with Node.js, we can use the os.cpus
method.