Exemple #1
0
 private function doFsStat($fh)
 {
     $promisor = new Deferred();
     \uv_fs_fstat($this->loop, $fh, function ($fh, $stat) use($promisor) {
         if ($fh) {
             $stat["isdir"] = (bool) ($stat["mode"] & \UV::S_IFDIR);
             $stat["isfile"] = !$stat["isdir"];
             $promisor->succeed($stat);
         } else {
             $promisor->succeed();
         }
     });
     return $promisor->promise();
 }
Exemple #2
0
<?php

uv_fs_open(uv_default_loop(), __FILE__, UV::O_RDONLY, 0, function ($r) {
    uv_fs_fstat(uv_default_loop(), $r, function ($result, $da) {
        var_dump($da);
    });
});
uv_run();
 /**
  * @todo
  * @param resource $fd
  * @param callable $callback
  * @return $this
  */
 public function fstat($fd, callable $callback = null)
 {
     $self = $this;
     \uv_fs_fstat($this->getLoop()->getBackend(), $fd, function ($fd) use($callback, $self) {
         $callback($self, $fd);
     });
     return $this;
 }