endianness method of OS module of node.js


This method is used to get the endianness of the CPU for which the node.js binary was compiled.
Possible values are :

  • 'BE' : for big endian
  • 'LE' : for little endian
This method returns String . Code snippet is given below :


//Name of the file: endianness.js
var os = require('os');
var value =  os.endianness();
console.log("os.endianness() => " + value);			


  • Now run the snippet using the following command :
    >node endianness.js
    os.endianness() => LE