src/Messages/Bodies/StreamedBinary.php 1 location
|
@@ 35-45 (lines=11) @@
|
32 |
|
$offset = 0; |
33 |
|
$playhead = 0; |
34 |
|
|
35 |
|
while($offset < $length) |
36 |
|
{ |
37 |
|
$content = substr($wholeContent, $offset, $this->chunkSize->toBytes()); |
38 |
|
$playhead++; |
39 |
|
|
40 |
|
$chunk = new Chunk($playhead, $offset, $content, $this->metadata); |
41 |
|
yield $chunk; |
42 |
|
|
43 |
|
$offset += $chunk->size(); |
44 |
|
unset($chunk, $content); |
45 |
|
} |
46 |
|
} |
47 |
|
} |
src/Messages/Bodies/StreamedFile.php 1 location
|
@@ 55-65 (lines=11) @@
|
52 |
|
|
53 |
|
$stream = fopen($this->filepath, 'r'); |
54 |
|
|
55 |
|
while(! feof($stream)) |
56 |
|
{ |
57 |
|
$content = fread($stream, $this->chunkSize->toBytes()); |
58 |
|
$playhead++; |
59 |
|
|
60 |
|
$chunk = new Chunk($playhead, $offset, $content, $this->metadata); |
61 |
|
yield $chunk; |
62 |
|
|
63 |
|
$offset += $chunk->size(); |
64 |
|
unset($chunk, $content); |
65 |
|
} |
66 |
|
|
67 |
|
fclose($stream); |
68 |
|
} |