0

I am creating a Node app that parses a file but I don't know if it will be using \r\n or \n as the newline character. I can check the first new line character in the file and see if is \r\n or \n and then store it as my newline variable but is there a more elegant solution? I know about the {EOL} from os module but that always give \r\n for windows but a window file could be using both \n or \r\n.

Also I don't want to use regex to replace all \r\n with \n for performance reasons.

kol man
  • 1
  • 1

1 Answers1

-1

\n works, I’ve tested it myself.

Drqgs
  • 24
  • 2