Endianness refers to the order of bits in a sequence within a binary representation of a number.
The os.endianness() method is an inbuilt application programming interface of the os module which is used to get endianness of the CPU of the computer for which the node.js is compiled.
Parameters: This method does not accept any parameters.
Return Value: This method returns a string value that specifies the endianness of the CPU. The returned string will be either
BE (for big endian) or
LE (for little endian).
- LE: It is the most significant bits/values in the sequence that is stored in higher memory address.
- BE: It is the most significant bits/values in the sequence that is stored in lower memory address.
Below examples illustrate the use of os.endianness() method in Node.js:
CPU is little endian format
Note: The above program will compile and run by using the
node index.js command.
- Nodejs | Automatic restart NodeJs server with nodemon
- Nodejs | DNS
- Nodejs | DNS | setServers()
- Nodejs | Jimp
- Web-Socket in NodeJS
- Dockerizing a simple Nodejs app
- Nodejs | GM sharpen() Function
- Nodejs | GM blur() Function
- Difference between NodeJS and AngularJS
- Nodejs | Web Crawling using Cheerio
- Nodejs | GM charcoal() Function
- Encrypting Data in NodeJS
- Nodejs – Connect Mysql with Node app
- Signup Form Using Nodejs and MongoDB
- NodeJs - Handling invalid routes
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.