const os = require('os');
const fs = require('fs');
// Get the OS-specific end-of-line marker
console.log(`End-of-Line Marker: ${JSON.stringify(os.EOL)}`);
// Windows: \r\n
// POSIX: \n
// Using EOL when writing to a file
fs.writeFileSync('example.txt',
`Line 1${os.EOL}Line 2${os.EOL}Line 3${os.EOL}`,
'utf8'
);
console.log('Created file with OS-specific line endings');
End-of-Line Marker: "\n" Created file with OS-specific line endings