scramjetorg / scramjet

Public tracker for Scramjet Cloud Platform, a platform that bring data from many environments together.
https://www.scramjet.org
MIT License
253 stars 20 forks source link

BufferStream/StringStream fromFile / toFile methods. #92

Closed MichalCz closed 2 years ago

MichalCz commented 4 years ago

Is your feature request related to a problem? Please describe.

Every time we need to parse a file there's a lot of code needed.

Describe the solution you'd like

This should work:

StringStream.fromFile('./path/to/file', {encoding: 'utf-8'})
    .lines()
    .reduce((sum, x) => sum + (x ? 1 : 0))
MichalCz commented 3 years ago

Ok, slight mod... should be fromUri?