LineStreamExtensions extension

Extensions on Stream<String> that treat it as a stream of discrete lines (as commonly emitted by a shell script).

on

Properties

bytes Stream<List<int>>
Converts this to a byte stream with newlines baked in.
no setter
teeToStderr Stream<String>
Returns a stream that emits the same events as this one, but also prints each string to currentStderr.
no setter

Methods

grep(String regexp, {bool exclude = false, bool onlyMatching = false, bool caseSensitive = true, bool unicode = false, bool dotAll = false}) Stream<String>
Returns the elements of this that match regexp.
replace(String regexp, String replacement, {bool all = false, bool caseSensitive = true, bool unicode = false, bool dotAll = false}) Stream<String>
Replaces matches of regexp with replacement.
replaceMapped(String regexp, String replace(Match match), {bool all = false, bool caseSensitive = true, bool unicode = false, bool dotAll = false}) Stream<String>
Replaces matches of regexp with the result of calling replace.
withSpans({Uri? sourceUrl, String? sourcePath}) Stream<Tuple2<String, SourceSpanWithContext>>
Returns a stream of lines along with FileSpans indicating the position of those lines within the original source (assuming that this stream is the entirety of the source).
xargs(FutureOr<void> callback(List<String> args), {int? maxArgs, String? name, void onSignal(ProcessSignal signal)?}) Script
Passes the strings emitted by this stream as arguments to callback.

Operators

operator >(StreamConsumer<List<int>> consumer) Future<void>
Shorthand for stream.bytes.pipe.
operator |(Script script) Script
Pipes this into script's stdin with newlines baked in.