Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function scandir($path)
 {
     $this->reactor->addRef();
     $promisor = new Deferred();
     uv_fs_readdir($this->loop, $path, 0, function ($fh, $data) use($promisor, $path) {
         $this->reactor->delRef();
         if (empty($fh)) {
             $promisor->fail(new \RuntimeException("Failed reading contents from {$path}"));
         } else {
             $promisor->succeed($data);
         }
     });
     return $promisor->promise();
 }
Пример #2
0
<?php

uv_fs_readdir(uv_default_loop(), ".", 0, function ($result, $da) {
    var_dump($da);
});
uv_run();
Пример #3
0
 public function readDir($path, $callback)
 {
     uv_fs_readdir($this->getEventLoop(), $path, 0, $callback);
 }