first commit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Kiri\Router;
|
||||
|
||||
class ChunkResponse extends Response
|
||||
{
|
||||
|
||||
public int $limit;
|
||||
|
||||
|
||||
/**
|
||||
* @param object $response
|
||||
* @return void
|
||||
*/
|
||||
public function write(object $response): void
|
||||
{
|
||||
$body = $this->getBody();
|
||||
$total = ceil($this->limit / $body->getSize());
|
||||
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$body->seek($i);
|
||||
|
||||
$response->write($body->read($this->limit));
|
||||
}
|
||||
$response->end();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user