I'm reading and writing to an external process using two Pipes. Every command response will be terminated by "\n] ". I'm currently reading from the pipe as an AsyncSequence (readPipe.fileHandleForReading.bytes.characters
). I'd like to read from the pipe until the terminator sequence.
I know how to roll my own solution to this, accumulating characters in a window and checking for the delimiter, but I was surprised that there wasn't anything a little more out-of-the-box, including in AsyncAlgorithms. Is there a way to split/chunk an AsyncSequence on a multi-element delimiter, or anything similar to that?