Skip to content

Commit 6691355

Browse files
committed
optimize get and put
1 parent 85b101b commit 6691355

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/NativeShare.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function put($source, $target) {
174174
$sourceHandle = fopen($source, 'rb');
175175
$targetHandle = $this->state->create($this->buildUrl($target));
176176

177-
while ($data = fread($sourceHandle, 4096)) {
177+
while ($data = fread($sourceHandle, NativeReadStream::CHUNK_SIZE)) {
178178
$this->state->write($targetHandle, $data);
179179
}
180180
$this->state->close($targetHandle);
@@ -214,7 +214,7 @@ public function get($source, $target) {
214214
throw new InvalidResourceException('Failed opening remote file "' . $source . '" for reading');
215215
}
216216

217-
while ($data = $this->state->read($sourceHandle, 4096)) {
217+
while ($data = $this->state->read($sourceHandle, NativeReadStream::CHUNK_SIZE)) {
218218
fwrite($targetHandle, $data);
219219
}
220220
$this->state->close($sourceHandle);

0 commit comments

Comments
 (0)