Skip to content

Commit

Permalink
optimize get and put
Browse files Browse the repository at this point in the history
  • Loading branch information
icewind1991 committed Aug 16, 2017
1 parent 85b101b commit 6691355
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/NativeShare.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function put($source, $target) {
$sourceHandle = fopen($source, 'rb');
$targetHandle = $this->state->create($this->buildUrl($target));

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

while ($data = $this->state->read($sourceHandle, 4096)) {
while ($data = $this->state->read($sourceHandle, NativeReadStream::CHUNK_SIZE)) {
fwrite($targetHandle, $data);
}
$this->state->close($sourceHandle);
Expand Down

0 comments on commit 6691355

Please sign in to comment.