File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -379,7 +379,8 @@ changes:
379
379
end-of-line input. Default to ` 100 ` milliseconds.
380
380
` crlfDelay ` will be coerced to a number no less than ` 100 ` . It can be set to
381
381
` Infinity ` , in which case ` \r ` followed by ` \n ` will always be considered a
382
- single newline.
382
+ single newline (which may be reasonable for [ reading files] [ ] with ` \r\n `
383
+ line delimiter).
383
384
* ` removeHistoryDuplicates ` {boolean} If ` true ` , when a new input line added
384
385
to the history list duplicates an older one, this removes the older line
385
386
from the list. Defaults to ` false ` .
@@ -532,7 +533,8 @@ const readline = require('readline');
532
533
const fs = require (' fs' );
533
534
534
535
const rl = readline .createInterface ({
535
- input: fs .createReadStream (' sample.txt' )
536
+ input: fs .createReadStream (' sample.txt' ),
537
+ crlfDelay: Infinity
536
538
});
537
539
538
540
rl .on (' line' , (line ) => {
@@ -547,3 +549,4 @@ rl.on('line', (line) => {
547
549
[ Readable ] : stream.html#stream_readable_streams
548
550
[ TTY ] : tty.html
549
551
[ Writable ] : stream.html#stream_writable_streams
552
+ [ reading files ] : #readline_example_read_file_stream_line_by_line
You can’t perform that action at this time.
0 commit comments