Node.JS constant for platform-specific new line?

node.js

Solution

There is a constant `os.EOL`:

import { EOL } from "node:os";

or

const { EOL } = require("os");

`EOL` then has a value of `"\n"` on POSIX or `"\r\n"` on Windows.

Problem

Is there a constant available in Node.JS for a newline character that is specific to the platform the application is running on? For example: - Windows: `\r\n` - *nix: `\n`

Original source