特定于平台的新行的Node.JS常量? [英] Node.JS constant for platform-specific new line?

查看:55
本文介绍了特定于平台的新行的Node.JS常量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Node.JS中是否有一个常量,用于换行符,该常量特定于应用程序在其上运行的平台?

Is there a constant available in Node.JS for a newline character that is specific to the platform the application is running on?

例如:

  • Windows:\r\n
  • * nix:\n
  • Windows: \r\n
  • *nix: \n

推荐答案

不确定在0.8.x中这是否是新功能,但现在有一个常量

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;

这篇关于特定于平台的新行的Node.JS常量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆