Skip to content

Commit 4377fd4

Browse files
committed
Closes #13
1 parent 121bac6 commit 4377fd4

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

CallableStream.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
class CallableStream implements StreamInterface
2323
{
24-
2524
/** @var callable */
2625
private $callable;
2726

@@ -116,7 +115,7 @@ public function read($length): string
116115

117116
public function getContents(): string
118117
{
119-
return $this->read(1048576); // 1MB
118+
return $this->read(65536); // 64KB
120119
}
121120

122121
public function getMetadata($key = null)
@@ -153,12 +152,11 @@ private function reader(int $length): Generator
153152
if (false === @fwrite($resource, ($this->callable)())) {
154153
throw new RuntimeException('Cannot write to stream');
155154
}
156-
fseek($resource, 0);
157155

156+
fseek($resource, 0);
158157
while (false === feof($resource)) {
159158
yield fread($resource, $length);
160159
}
161-
162160
fclose($resource);
163161
}
164162
}

0 commit comments

Comments
 (0)