Use os.eol for line endings

When running in node, use os.eol to choose line endings - windows will use \r\n, linux will use \n.

Fixes #260