You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
byline with keepEmptyLines: true behaves slightly differently than most line readers I've encountered, including node's readline module. I created sample.txt by running:
byline will return 5 chunks for this file (or 3 with keepEmptyLines: false). The readline sample returns four lines:
Line from file: foo
Line from file: bar
Line from file:
Line from file: and baz
As does this C# program:
usingSystem;usingSystem.IO;classProgram{staticvoidMain(string[]args){using(varstream=newFileStream("sample.txt",FileMode.Open))using(varreader=newStreamReader(stream)){stringline;while(null!=(line=reader.ReadLine())){Console.WriteLine($"Line from file: {line}");}}}}
(perl -ne 'print "Line from file: $_";' sample.txt also prints 4 lines, but with newlines still attached.)
If byline's current behavior is considered by design, it would be nice if there was a new option to ignore the trailing EOL in a stream. This would make byline more of a drop-in replacement for readline.
The text was updated successfully, but these errors were encountered:
byline with
keepEmptyLines: true
behaves slightly differently than most line readers I've encountered, including node'sreadline
module. I created sample.txt by running:byline will return 5 chunks for this file (or 3 with
keepEmptyLines: false
). The readline sample returns four lines:As does this C# program:
(
perl -ne 'print "Line from file: $_";' sample.txt
also prints 4 lines, but with newlines still attached.)If byline's current behavior is considered by design, it would be nice if there was a new option to ignore the trailing EOL in a stream. This would make byline more of a drop-in replacement for
readline
.The text was updated successfully, but these errors were encountered: