Skip to content

Make it possible to supply chunk size to transfer() & transmit()#357

Open
thekid wants to merge 2 commits intoxp-framework:mainfrom
thekid:feature/transmit-chunks
Open

Make it possible to supply chunk size to transfer() & transmit()#357
thekid wants to merge 2 commits intoxp-framework:mainfrom
thekid:feature/transmit-chunks

Conversation

@thekid
Copy link
Member

@thekid thekid commented Feb 15, 2026

Example:

use io\streams\StreamTransfer;

$s= new StreamTransfer($in, $out);
$size= 0;
foreach ($s->transmit(1024) as $transferred) {
  $size+= $transferred;
  Console::write("\r", $size, ' byte(s) transferred');
}
$s->close();

@thekid
Copy link
Member Author

thekid commented Feb 15, 2026

This breaks yielding this inside a web context:

yield from $stream->transmit();

...as the returned numbers are (erroneously) interpreted as delays by the async server before https://github.com/xp-framework/networking/releases/tag/v10.5.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments