Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: clarify using crlfDelay with fs streams #16259

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions doc/api/readline.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,8 @@ changes:
end-of-line input. Default to `100` milliseconds.
`crlfDelay` will be coerced to a number no less than `100`. It can be set to
`Infinity`, in which case `\r` followed by `\n` will always be considered a
single newline.
single newline (which may be reasonable for [reading files][] with `\r\n`
line delimiter).
* `removeHistoryDuplicates` {boolean} If `true`, when a new input line added
to the history list duplicates an older one, this removes the older line
from the list. Defaults to `false`.
Expand Down Expand Up @@ -532,7 +533,8 @@ const readline = require('readline');
const fs = require('fs');

const rl = readline.createInterface({
input: fs.createReadStream('sample.txt')
input: fs.createReadStream('sample.txt'),
crlfDelay: Infinity
});

rl.on('line', (line) => {
Expand All @@ -547,3 +549,4 @@ rl.on('line', (line) => {
[Readable]: stream.html#stream_readable_streams
[TTY]: tty.html
[Writable]: stream.html#stream_writable_streams
[reading files]: #readline_example_read_file_stream_line_by_line