diff --git a/doc/api/os.markdown b/doc/api/os.markdown index 0a8a17fd39..33eb9b6317 100644 --- a/doc/api/os.markdown +++ b/doc/api/os.markdown @@ -129,3 +129,6 @@ Get a list of network interfaces: vmnet8: [ { address: '10.88.88.1', family: 'IPv4', internal: false } ], ppp0: [ { address: '10.2.0.231', family: 'IPv4', internal: false } ] } +## os.EOL + +A constant defining the appropriate End-of-line marker for the operating system. diff --git a/lib/os.js b/lib/os.js index 8bd421b087..c21971c84b 100644 --- a/lib/os.js +++ b/lib/os.js @@ -42,3 +42,5 @@ exports.getNetworkInterfaces = function() { }; module.deprecate('getNetworkInterfaces', 'It is now called `os.networkInterfaces`.'); + +exports.EOL = process.platform === 'win32' ? '\r\n' : '\n'; diff --git a/test/simple/test-os.js b/test/simple/test-os.js index 92d1a264c1..a70142f9f7 100644 --- a/test/simple/test-os.js +++ b/test/simple/test-os.js @@ -79,3 +79,6 @@ switch (platform) { assert.deepEqual(actual, expected); break; } + +var EOL = os.EOL; +assert.ok(EOL.length > 0);