CoderFunda
  • Home
  • About us
    • Contact Us
    • Disclaimer
    • Privacy Policy
    • About us
  • Home
  • Php
  • HTML
  • CSS
  • JavaScript
    • JavaScript
    • Jquery
    • JqueryUI
    • Stock
  • SQL
  • Vue.Js
  • Python
  • Wordpress
  • C++
    • C++
    • C
  • Laravel
    • Laravel
      • Overview
      • Namespaces
      • Middleware
      • Routing
      • Configuration
      • Application Structure
      • Installation
    • Overview
  • DBMS
    • DBMS
      • PL/SQL
      • SQLite
      • MongoDB
      • Cassandra
      • MySQL
      • Oracle
      • CouchDB
      • Neo4j
      • DB2
      • Quiz
    • Overview
  • Entertainment
    • TV Series Update
    • Movie Review
    • Movie Review
  • More
    • Vue. Js
    • Php Question
    • Php Interview Question
    • Laravel Interview Question
    • SQL Interview Question
    • IAS Interview Question
    • PCS Interview Question
    • Technology
    • Other

12 February, 2019

Node.js OS

 Programing Coderfunda     February 12, 2019     Nodejs-Hindi, Nodejs-OS     No comments   

Node.js OS

Node.js OS provides some basic operating-system related utility functions. Let's see the list generally used functions or methods.
Index Method Description
1. os.arch() This method is used to fetch the operating system CPU architecture.
2.
os.cpus()
This method is used to fetch an array of objects containing information about each cpu/core installed: model, speed (in MHz), and times (an object containing the number of milliseconds the cpu/core spent in: user, nice, sys, idle, and irq).
3. os.endianness() This method returns the endianness of the cpu. Its possible values are 'BE' for big endian or 'LE' for little endian.
4. os.freemem() This methods returns the amount of free system memory in bytes.
5. os.homedir() This method returns the home directory of the current user.
6.
os.hostname()
This method is used to returns the hostname of the operating system.
7. os.loadavg() This method returns an array containing the 1, 5, and 15 minute load averages. The load average is a time fraction taken by system activity, calculated by the operating system and expressed as a fractional number.
8. os.networkinterfaces() This method returns a list of network interfaces.
9. os.platform() This method returns the operating system platform of the running computer i.e.'darwin', 'win32','freebsd', 'linux', 'sunos' etc.
10. os.release() This method returns the operating system release.
11. os.tmpdir() This method returns the operating system's default directory for temporary files.
12. os.totalmem() This method returns the total amount of system memory in bytes.
13. os.type() This method returns the operating system name. For example 'linux' on linux, 'darwin' on os x and 'windows_nt' on windows.
14. os.uptime() This method returns the system uptime in seconds.
15. os.userinfo([options]) This method returns a subset of the password file entry for the current effective user.

IN - HINDI


Node.js OS कुछ बुनियादी ऑपरेटिंग-सिस्टम संबंधित उपयोगिता फ़ंक्शंस प्रदान करता है। आइए सूची को आमतौर पर उपयोग किए जाने वाले कार्यों या विधियों को देखें।
सूचकांक विधि विवरण
1. os.arch () इस पद्धति का उपयोग ऑपरेटिंग सिस्टम CPU आर्किटेक्चर लाने के लिए किया जाता है।
2।
os.cpus ()
इस विधि का उपयोग उन वस्तुओं की एक सरणी को लाने के लिए किया जाता है जिनमें प्रत्येक cpu / कोर के बारे में जानकारी होती है: मॉडल, गति (मेगाहर्ट्ज में), और समय (मिलीसेकंड की संख्या वाली एक वस्तु जिसमें cpu / कोर का खर्च होता है: उपयोगकर्ता, अच्छा, sys बेकार, और irq)।
3. os.endianness () यह विधि cpu की समाप्ति को लौटाती है। इसके संभावित मूल्य बड़े एंडियन के लिए 'बीई' या छोटे एंडियन के लिए 'एलई' हैं।
4. os.freemem () यह विधि बाइट्स में मुफ्त सिस्टम मेमोरी की मात्रा लौटाती है।
5. os.homedir () यह विधि वर्तमान उपयोगकर्ता की होम डायरेक्टरी लौटाती है।
6।
os.hostname ()
इस पद्धति का उपयोग ऑपरेटिंग सिस्टम के होस्टनाम को वापस करने के लिए किया जाता है।
7. os.loadavg () यह विधि एक सरणी देता है जिसमें 1, 5 और 15 मिनट का लोड औसत होता है। लोड औसत सिस्टम गतिविधि द्वारा लिया गया एक समय का अंश है, जिसे ऑपरेटिंग सिस्टम द्वारा गणना की जाती है और एक भिन्नात्मक संख्या के रूप में व्यक्त किया जाता है।
8. os.networkinterfaces () यह विधि नेटवर्क इंटरफेस की एक सूची लौटाती है।
9. os.platform () यह विधि चल रहे कंप्यूटर के ऑपरेटिंग सिस्टम प्लेटफॉर्म को लौटा देती है यानी 'win32', 'win32', 'freebsd', 'linux', 'sunos' आदि।
10. os.release () यह विधि ऑपरेटिंग सिस्टम रिलीज़ लौटाती है।
11. os.tmpdir () यह विधि अस्थायी फ़ाइलों के लिए ऑपरेटिंग सिस्टम की डिफ़ॉल्ट निर्देशिका लौटाती है।
12. os.totalmem () यह विधि बाइट्स में सिस्टम मेमोरी की कुल राशि लौटाती है।
13. os.type () यह विधि ऑपरेटिंग सिस्टम नाम लौटाती है। उदाहरण के लिए 'linux' पर linux, os x पर 'darwin' और windows पर 'windows_nt'।
14. os.uptime () यह विधि सेकंड में सिस्टम अपटाइम लौटाती है।
15. os.userinfo ([विकल्प]) यह विधि मौजूदा प्रभावी उपयोगकर्ता के लिए पासवर्ड फ़ाइल प्रविष्टि का सबसेट लौटाती है।

Node.js OS उदाहरण 1

इस उदाहरण में, हम कुछ बुनियादी कार्यों को शामिल कर रहे हैं। निम्नलिखित कोड वाले os_example1.js नाम की फ़ाइल बनाएँ:

फ़ाइल: os_example1.js

     const os = आवश्यकता ('os');
     कंसोल.लॉग ("os.freemem (): \ n", os.freemem ());
     कंसोल.लॉग ("os.homedir (): \ n", os.homedir ());
     कंसोल.लॉग ("os.hostname (): \ n", os.hostname ());
     कंसोल.लॉग ("os.endianness (): \ n", os.endianness ());
     कंसोल.लॉग ("os.loadavg (): \ n", os.loadavg ());
     कंसोल.लॉग ("os.platform (): \ n", os.platform ());
     कंसोल.लॉग ("os.release (): \ n", os.release ());
     कंसोल.लॉग ("os.tmpdir (): \ n", os.tmpdir ());
     कंसोल.लॉग ("os.totalmem (): \ n", os.totalmem ());
     कंसोल.लॉग ("os.type (): \ n", os.type ());
     कंसोल.लॉग ("os.uptime (): \ n", os.uptime ());

or English 

Node.js OS Example 1

In this example, we are including some basic functions. Create a file named os_example1.js having the following code:
File: os_example1.js
  1. const os=require('os');  
  2. console.log("os.freemem(): \n",os.freemem());  
  3. console.log("os.homedir(): \n",os.homedir());  
  4. console.log("os.hostname(): \n",os.hostname());  
  5. console.log("os.endianness(): \n",os.endianness());  
  6. console.log("os.loadavg(): \n",os.loadavg());  
  7. console.log("os.platform(): \n",os.platform());  
  8. console.log("os.release(): \n",os.release());  
  9. console.log("os.tmpdir(): \n",os.tmpdir());  
  10. console.log("os.totalmem(): \n",os.totalmem());  
  11. console.log("os.type(): \n",os.type());  
  12. console.log("os.uptime(): \n",os.uptime());  
Open Node.js command prompt and run the following code:
  1. node os_example1.js 
 Node.js OS उदाहरण 2

इस उदाहरण में, हम शेष कार्यों को शामिल कर रहे हैं। निम्नलिखित कोड वाले os_example2.js नामक फ़ाइल बनाएँ:

फ़ाइल: os_example2.js

     const os = आवश्यकता ('os');
     कंसोल.लॉग ("os.cpus (): \ n", os.cpus ());
     कंसोल.लॉग ("os.arch (): \ n", os.arch ());
     कंसोल.लॉग ("os.networkInterfaces (): \ n", os.networkInterfaces ());

Node.js कमांड प्रॉम्प्ट खोलें और निम्न कोड चलाएँ:

     नोड os_example2.js


Node.js OS Example 2

In this example, we are including remaining functions. Create a file named os_example2.js having the following code:

File: os_example2.js

    const os=require('os'); 
    console.log("os.cpus(): \n",os.cpus()); 
    console.log("os.arch(): \n",os.arch()); 
    console.log("os.networkInterfaces(): \n",os.networkInterfaces());  

Open Node.js command prompt and run the following code:

    node os_example2.js  


  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook

Related Posts:

  • Node.js First ExampleNode.js पहला उदाहरणकंसोल-आधारित और वेब-आधारित नोड.जेएस अनुप्रयोग हो सकते हैं।Node.js कंसोल-आधारित उदाहरणफ़ाइल: कंसोल_एक्सप्लेन 1। जेएस  &nbs… Read More
  • Node.js Command Line OptionsNode.js कमांड लाइन विकल्प - Node.js Command Line OptionsNode.js. में कमांड लाइन विकल्पों की एक विस्तृत विविधता है। ये विकल्प स्क्रिप्ट और अन्य सहायक र… Read More
  • Node.js ConsoleNode.js कंसोलNode.js कंसोल मॉड्यूल वेब ब्राउज़र द्वारा प्रदान किए गए जावास्क्रिप्ट कंसोल तंत्र के समान एक सरल डीबगिंग कंसोल प्रदान करता है।तीन कंसोल त… Read More
  • Node.js REPLNode.js REPLREPL शब्द का अर्थ Read Eval Print और Loop है। यह एक विंडो कंसोल या एक यूनिक्स / लिनक्स शेल जैसे कंप्यूटर वातावरण को निर्दिष्ट करता है जहां… Read More
  • Node.js Package ManagerNode.js पैकेज मैनेजरनोड पैकेज मैनेजर दो मुख्य कार्यशीलता प्रदान करता है:     यह नोड.जेएस पैकेज / मॉड्यूल के लिए ऑनलाइन रिपॉजिटरी प… Read More
Newer Post Older Post Home

0 comments:

Post a Comment

Thanks

Meta

Popular Posts

  • Spring boot app (error: method getFirst()) failed to run at local machine, but can run on server
    The Spring boot app can run on the online server. Now, we want to replicate the same app at the local machine but the Spring boot jar file f...
  • Log activity in a Laravel app with Spatie/Laravel-Activitylog
      Requirements This package needs PHP 8.1+ and Laravel 9.0 or higher. The latest version of this package needs PHP 8.2+ and Laravel 8 or hig...
  • Laravel auth login with phone or email
          <?php     Laravel auth login with phone or email     <? php     namespace App \ Http \ Controllers \ Auth ;         use ...
  • Failed to install 'cordova-plugin-firebase': CordovaError: Uh oh
    I had follow these steps to install an configure firebase to my cordova project for cloud messaging. https://medium.com/@felipepucinelli/how...
  • Vue3 :style backgroundImage not working with require
    I'm trying to migrate a Vue 2 project to Vue 3. In Vue 2 I used v-bind style as follow: In Vue 3 this doesn't work... I tried a...

Categories

  • Ajax (26)
  • Bootstrap (30)
  • DBMS (42)
  • HTML (12)
  • HTML5 (45)
  • JavaScript (10)
  • Jquery (34)
  • Jquery UI (2)
  • JqueryUI (32)
  • Laravel (1017)
  • Laravel Tutorials (23)
  • Laravel-Question (6)
  • Magento (9)
  • Magento 2 (95)
  • MariaDB (1)
  • MySql Tutorial (2)
  • PHP-Interview-Questions (3)
  • Php Question (13)
  • Python (36)
  • RDBMS (13)
  • SQL Tutorial (79)
  • Vue.js Tutorial (68)
  • Wordpress (150)
  • Wordpress Theme (3)
  • codeigniter (108)
  • oops (4)
  • php (853)

Social Media Links

  • Follow on Twitter
  • Like on Facebook
  • Subscribe on Youtube
  • Follow on Instagram

Pages

  • Home
  • Contact Us
  • Privacy Policy
  • About us

Blog Archive

  • September (100)
  • August (50)
  • July (56)
  • June (46)
  • May (59)
  • April (50)
  • March (60)
  • February (42)
  • January (53)
  • December (58)
  • November (61)
  • October (39)
  • September (36)
  • August (36)
  • July (34)
  • June (34)
  • May (36)
  • April (29)
  • March (82)
  • February (1)
  • January (8)
  • December (14)
  • November (41)
  • October (13)
  • September (5)
  • August (48)
  • July (9)
  • June (6)
  • May (119)
  • April (259)
  • March (122)
  • February (368)
  • January (33)
  • October (2)
  • July (11)
  • June (29)
  • May (25)
  • April (168)
  • March (93)
  • February (60)
  • January (28)
  • December (195)
  • November (24)
  • October (40)
  • September (55)
  • August (6)
  • July (48)
  • May (2)
  • January (2)
  • July (6)
  • June (6)
  • February (17)
  • January (69)
  • December (122)
  • November (56)
  • October (92)
  • September (76)
  • August (6)

  • Failed to install 'cordova-plugin-firebase': CordovaError: Uh oh - 9/21/2024
  • pyspark XPath Query Returns Lists Omitting Missing Values Instead of Including None - 9/20/2024
  • SQL REPL from within Python/Sqlalchemy/Psychopg2 - 9/20/2024
  • MySql Explain with Tobias Petry - 9/20/2024
  • How to combine information from different devices into one common abstract virtual disk? [closed] - 9/20/2024

Laravel News

  • Auto-translate Application Strings with Laratext - 5/16/2025
  • Simplify Factory Associations with Laravel's UseFactory Attribute - 5/13/2025
  • Improved Installation and Frontend Hooks in Laravel Echo 2.1 - 5/15/2025
  • Filter Model Attributes with Laravel's New except() Method - 5/13/2025
  • Arr::from() Method in Laravel 12.14 - 5/14/2025

Copyright © 2025 CoderFunda | Powered by Blogger
Design by Coderfunda | Blogger Theme by Coderfunda | Distributed By Coderfunda