OS
os.EOL
Returns the platform newline sequence. Use it for local text when platform conventions matter; use the protocol-specified newline for network formats. Tested on Node.js 22.16.0. Example output (one line per entry): ["true"].
Formal Syntax & Structure
nodejs syntaxnodejs
os.EOLReturn Value
string
LF or CRLF.
Working Example
Example Snippetnodejs
import os from 'node:os';console.log(['\n', '\r\n'].includes(os.EOL));