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
Newer Post Older Post Home

0 comments:

Post a Comment

Thanks

Meta

Popular Posts

  • ✅ Command Validator: validate the input of console commands
    Command Validator is a Laravel package to validate the input of console commands. ✅ https://github.com/cerbero90/command-validator Th...
  • Laravel DynamoDB Eloquent Models and Query Builder
    Laravel   DynamoDB   is a DynamoDB-based Eloquent model and Query builder for Laravel. Using the provided Dynamo driver, models extend the E...
  • CSS Box Model
    All HTML elements can be considered as boxes. In CSS, the term "box model" is used when talking about design and layout. The CSS b...
  • Campfire Coders (The post-Laracon-'24 recap episode!)
    submitted by /u/JerseyMilker [link] [comments]
  • Build your own Slack Bot with this PHP library
    It seems like everyone is using Slack, from company channels to community groups including one for   Laravel . Bots have been the new rage w...

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 (69)
  • 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

  • July (4)
  • 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)

Loading...

Laravel News

Loading...

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