diff options
author | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2017-10-17 18:41:27 +0300 |
---|---|---|
committer | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2017-10-19 02:15:13 +0300 |
commit | e2cddbb8ccdb7b3c4a40c8acc630f68703bc77b5 (patch) | |
tree | 894f55419973d5227900fc5ac561bc53789979db /doc | |
parent | aec115b54b5c9957c4dacf38f11122b08dc41086 (diff) | |
download | android-node-v8-e2cddbb8ccdb7b3c4a40c8acc630f68703bc77b5.tar.gz android-node-v8-e2cddbb8ccdb7b3c4a40c8acc630f68703bc77b5.tar.bz2 android-node-v8-e2cddbb8ccdb7b3c4a40c8acc630f68703bc77b5.zip |
doc: clarify using crlfDelay with fs streams
PR-URL: https://github.com/nodejs/node/pull/16259
Fixes: https://github.com/nodejs/node/issues/16077
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/readline.md | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/doc/api/readline.md b/doc/api/readline.md index 5c47f57cb4..353ef87f8f 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -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`. @@ -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) => { @@ -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 |