コード例 #1
0
ファイル: NativeStream.php プロジェクト: isklv/smb-bundle
 public function stream_read($count)
 {
     $result = $this->state->read($this->handle, $count);
     if (strlen($result) < $count) {
         $this->eof = true;
     }
     return $result;
 }
コード例 #2
0
ファイル: NativeShare.php プロジェクト: isklv/smb-bundle
 /**
  * Download a remote file
  *
  * @param string $source remove file
  * @param string $target local file
  * @return bool
  *
  * @throws \SMBBundle\SMB\Exception\NotFoundException
  * @throws \SMBBundle\SMB\Exception\InvalidTypeException
  */
 public function get($source, $target)
 {
     $this->connect();
     $sourceHandle = $this->state->open($this->buildUrl($source), 'r');
     $targetHandle = fopen($target, 'wb');
     while ($data = $this->state->read($sourceHandle, 4096)) {
         fwrite($targetHandle, $data);
     }
     $this->state->close($sourceHandle);
     return true;
 }