MCPcopy Create free account
hub / github.com/error311/FileRise / handleWrite

Method handleWrite

src/FileRise/Storage/CurlReadStream.php:149–173  ·  view source on GitHub ↗
($curlHandle, string $chunk)

Source from the content-addressed store, hash-verified

147 }
148
149 public function handleWrite($curlHandle, string $chunk): int
150 {
151 if ($this->closed || !is_resource($this->buffer)) {
152 return 0;
153 }
154
155 $len = strlen($chunk);
156 if ($len === 0) {
157 return 0;
158 }
159
160 if (@fseek($this->buffer, $this->writeOffset) !== 0) {
161 $this->fail('Unable to seek WebDAV read buffer.');
162 return 0;
163 }
164
165 $written = @fwrite($this->buffer, $chunk);
166 if ($written === false || $written !== $len) {
167 $this->fail('Unable to write WebDAV read buffer.');
168 return 0;
169 }
170
171 $this->writeOffset += $written;
172 return $written;
173 }
174
175 private function pump(int $desiredBytes): void
176 {

Callers

nothing calls this directly

Calls 1

failMethod · 0.95

Tested by

no test coverage detected