Node.JS constant for platform-specific new line?

前端 未结 2 495
南方客
南方客 2020-12-07 19:32

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:
2条回答
  •  星月不相逢
    2020-12-07 20:05

    Not sure if this is new in the 0.8.x but there is now a constant http://nodejs.org/api/os.html#os_os_eol

    var endOfLine = require('os').EOL;
    

提交回复
热议问题