public static async ValueTask <byte[]> ToArrayAsync( this IStreamProducer producer, int copyBufferSize = StreamConsumer.DefaultBufferSize, CancellationToken cancellationToken = default) { await using var consumer = StreamConsumer.ToArray(copyBufferSize); return(await producer.ConsumeAsync(consumer, cancellationToken).ConfigureAwait(false)); }