optimize get and put

This commit is contained in:
Robin Appelman 2017-08-16 17:57:01 +02:00
commit 6691355d93

View file

@ -174,7 +174,7 @@ class NativeShare extends AbstractShare {
$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);
@ -214,7 +214,7 @@ class NativeShare extends AbstractShare {
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);