nickewing / line-reader

Asynchronous line-by-line file reader for node.js
MIT License
453 stars 75 forks source link

Smart EOL Support #6

Closed vy closed 9 years ago

vy commented 12 years ago

IMHO, hardcoded \n should be replaced with os.EOL. Further, it would be really handy if line-separator could automatically make a decision between \n and \r\n by looking at the very first line.

jedwards1211 commented 9 years ago

Even then you can end up getting files that came from another OS, so I wouldn't recommend that. I just put in a pull request that uses the regexp /\r\n?|\n/ as the default separator (and adds the ability to use a regexp separator to begin with), so it automatically handles files from any platform correctly.

nickewing commented 9 years ago

I'll have to agree with @jedwards1211 on this one. Thanks to his recent PR, the new default is now /\r\n?|\n/.