-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Closed
Labels
good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.readlineIssues and PRs related to the built-in readline module.Issues and PRs related to the built-in readline module.
Description
https://nodejs.org/api/readline.html#readline_event_line
Emitted whenever the input stream receives a \n, usually received when the user hits enter, or return.
I have tested this code with Windows 7 and Node 5.5.0 on three input files with Win-like EOL (\r\n), *nix-like EOL (\n) and old-Mac-like EOL (\r), and all the outputs were the same.
const fs = require('fs');
const readline = require('readline');
const rl = readline.createInterface({
input: fs.createReadStream('test.txt', {encoding: 'utf8'}),
terminal: false,
historySize: 0
});
rl.on('line', line => {
console.log(JSON.stringify(line));
});
It seems readline correctly parses files with all the main EOLs.
Metadata
Metadata
Assignees
Labels
good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.readlineIssues and PRs related to the built-in readline module.Issues and PRs related to the built-in readline module.