-->

  • OS module in Nodejs

     

    OS module in Nodejs

     

     

     

    upload the file from nodejs



    This blog we have seen mongodb basic and how is it work with installation and after installation, we have already seen mongodb basic, CRUD operation, connect mongodb with nodejs, read, update, delete, POST, GET API etc. we should not face any problem while making Database, collection(table) and using the data in nodejs even whenever we will make API. Read data from mongodb in nodejs



    • # What is OS module
    • # Important functions of OS module

     

    What is OS Module ?

     

    In Node.js, the 'os' (operating system) module provides a set of methods to interact with the operating system. It allows you to access information about the system's resources, network interfaces, and other related details. Here are some commonly used functionalities provided by the OS module.

     

     

    const os = require("os");
    console.log(os.arch())
    
    

     

    Returns a string identifying the operating system CPU architecture (e.g., 'x64').


     

    OS module in Nodejs

     

     

    const os = require("os");
    console.log(os.freemem()/(1024*1024));
    console.log(os.freemem()/(1024*1024*1024));
    
    

     

    Returns the amount of free system memory in bytes. 


     

    OS module in Nodejs

     

     

     

    const os = require("os");
    
    console.log(os.totalmem()/(1024*1024));
    console.log(os.totalmem()/(1024*1024*1024));
    
    

     

    Returns the total amount of system memory in bytes.

     

     

    OS module in Nodejs

     

     

    const os = require("os");
    
    console.log(os.hostname());
    
    

     

    Returns the host name of the operating system.

     

    OS module in Nodejs

     

     

    const os = require("os");
    
    console.log(os.platform());
    
    

     

     

    Returns a string identifying the operating system platform (e.g., 'darwin', 'win32', 'linux').

     

     

    OS module in Nodejs

     

     

    const os = require("os");
    
    console.log(os.userInfo());
    

     


     

    OS module in Nodejs

     

     


    Disclaimer



    All tutorials are for informational and educational purposes only and have been made using our own routers, servers, websites and other vulnerable free resources. we do not contain any illegal activity. We believe that ethical hacking, information security and cyber security should be familiar subjects to anyone using digital information and computers. Hacking Truth is against misuse of the information and we strongly suggest against it. Please regard the word hacking as ethical hacking or penetration testing every time this word is used. We do not promote, encourage, support or excite any illegal activity or hacking.

     

  • 0 comments:

    Post a Comment

    For Any Tech Updates, Hacking News, Internet, Computer, Technology and related to IT Field Articles Follow Our Blog.