module Crystallabs::Helpers::Streams

Overview

Byte-stream helpers.

Defined in:

crystallabs-helpers.cr

Class Method Summary

Class Method Detail

def self.extract_lines(carry : Bytes, chunk : Bytes) : Tuple(Array(String), Bytes) #

Splits carry + chunk on the newline byte into complete lines, stripping a trailing \r (CRLF streams), and returns the extracted lines plus the leftover partial line to carry into the next call. Pure and side-effect free — the building block for tailing an fd/pipe.


[View source]