File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -379,7 +379,8 @@ changes:
379379 end-of-line input. Default to ` 100 ` milliseconds.
380380 ` crlfDelay ` will be coerced to a number no less than ` 100 ` . It can be set to
381381 ` 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).
383384 * ` removeHistoryDuplicates ` {boolean} If ` true ` , when a new input line added
384385 to the history list duplicates an older one, this removes the older line
385386 from the list. Defaults to ` false ` .
@@ -532,7 +533,8 @@ const readline = require('readline');
532533const fs = require (' fs' );
533534
534535const rl = readline .createInterface ({
535- input: fs .createReadStream (' sample.txt' )
536+ input: fs .createReadStream (' sample.txt' ),
537+ crlfDelay: Infinity
536538});
537539
538540rl .on (' line' , (line ) => {
@@ -547,3 +549,4 @@ rl.on('line', (line) => {
547549[ Readable ] : stream.html#stream_readable_streams
548550[ TTY ] : tty.html
549551[ 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