OS
os.endianness()
Reports the native byte order as LE or BE. A binary file or network protocol has its own byte order; use the appropriate explicit Buffer method instead of assuming host order. Tested on Node.js 22.16.0. Example output (one line per entry): ["true"].
Formal Syntax & Structure
nodejs syntaxnodejs
os.endianness()Return Value
string
LE or BE.
Working Example
Example Snippetnodejs
import os from 'node:os';console.log(['LE', 'BE'].includes(os.endianness()));