Retrieves a read-stream for a path.

@param string $path The path to the file.

@throws FileNotFoundException

@return resource|false The path resource or false on failure.
772376
public function readStream($path)
    {
        [$prefix, $path] = $this->getPrefixAndPath($path);

        return $this->getFilesystem($prefix)->readStream($path);
    }
787775
public function ls($path)
    {
        if (!$this->hasCheckout) {
            $this->checkout();
        }

        if ($path == '/') {
            $path = '';
        }

        if (false === file_exists($this->cwd . '/' . $path)) {
            throw new NotFoundException(sprintf('The path \'%s\' is not found in %s', $path, $this->cwd));
        }

        $finder = new Finder();
        $files = $finder->in($this->cwd . '/' . $path)->exclude(".git")->ignoreDotFiles(false)->depth('== 0');

        $filelist = array();
        $entries = array();
        foreach ($files as $file) {
            $log = $this->log(($path ? $path . '/' : '') . $file->getRelativePathname(), null, 1);

            $commit = reset($log);
            $kind = $file->isDir() ? VcsFileInfo::DIR : VcsFileInfo::FILE;
            $file = new VcsFileInfo($file->getFilename(), $this->getHead(), $kind);
            $file->setCommit($commit);

            $entries[] = $file;
        }

        return $entries;
    }
773950
public function find($path)
    {
        $file = $this->findFileAt($path);

        if (is_null($file)) {
            throw new FileNotFoundException('File "'.$path.'" was not found.');
        }

        return new File($this->api, $this->containerName(), $file);
    }
917569
public static function decodeFromFile($path)
    {
        if (!is_file($path)) {
            throw new FileException("File does not exist: {$path}");
        }

        $string = file_get_contents($path);

        if ($string === false) {
            throw new FileException("Failed to read the file: {$path}");
        }

        return static::decode($string);
    }
1003941
public function read($path)
    {
        $path = $this->applyPathPrefix($path);

        $object = $this->bucket->object($path);

        $contents = $object->downloadAsString();

        return compact('path', 'contents');
    }
1085084
public function readStream($path)
    {
        try {
            //获得一个临时文件
            $tmpfname       = FileFunction::getTmpFile();

            file_put_contents($tmpfname, $this->read($path)['contents'] );

            $handle         = fopen($tmpfname, 'r');

            //删除临时文件
            FileFunction::deleteTmpFile($tmpfname);

            return ['stream' => $handle];
        }catch (OssException $e){

        }

        return false;
    }
675481
public static function realpath($path)
    {
        // check for stream uri
        if (preg_match('~^[a-z0-9-_.]+://~', $path)) {
            $stats = (file_exists($path))? stat($path) : false;
            if ($stats && isset($stats['realpath'])) {
                return $stats['realpath'];
            }

            return ($stats !== false) ? $path : false;
        }

        return realpath($path);
    }
206615
public static function get($path)
    {
        $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION));
        if (!isset(self::$fileTypes[$ext])) {
            return false;
        }
        return self::$fileTypes[$ext];
    }
1196563
public function getUrl( $path )
    {
        if (!$this->has($path)) throw new FileNotFoundException($filePath.' not found');
        return ( $this->ssl ? 'https://' : 'http://' ) . ( $this->isCname ? ( $this->cdnDomain == '' ? $this->endPoint : $this->cdnDomain ) : $this->bucket . '.' . $this->endPoint ) . '/' . ltrim($path, '/');
    }
658127
public function fromPath($path)
    {
        $mimetype = null;

        if (static::isSupported())
        {
            if (!is_file($path)) {
                throw new \RuntimeException('File not found at '.$path);
            }

            if (!is_readable($path)) {
                throw new \RuntimeException('File not readable at '.$path);
            }

            $mimetype = $this->_getMimetype(strtolower(pathinfo($path, PATHINFO_EXTENSION)));
        }

        return $mimetype;
    }
256333
public function read($path)
	{
		$path = Util::normalizePath($path);

		$this->assertPresent($path);

		return (string) $this->adapter->read($path);
	}
753096
public function read($path)
    {
        $object = $this->applyPathPrefix($path);

        try {
            $contents = $this->client->getObject($this->bucket, $object);
        } catch (OssException $e) {
            return false;
        }

        return compact('contents', 'path');
    }
1039945
public function file($path)
    {
        return $this->files(dirname($path))->first(function ($file) use ($path) {
            return $file['path'] === $path;
        }, function () use ($path) {
            throw new FileNotFoundException("File [$path] not found!");
        });
    }
531686
public function directoryAt($path)
    {
        $file = $this->nodeAt($path);

        if (!$file instanceof Directory) {
            throw new NotDirectoryException();
        }

        return $file;
    }
1061672
public function downloadAction($path)
    {
        try {
            $this->setPath($path);
        } catch (NotFoundException $e) {
            throw $e;
        }

        $dbfile = new WDBFile($this->getpath());
        if (!$dbfile->isFile()) {
            throw new NotFoundException(
                'Can not send raw content of a directory!',
                0, null, TemplateHelper::getRoute($dbfile->getWDBPath())
            );
        }

        $this->wdb->getResponse()
            ->download($path, 'text/plain');
        exit(0);
    }
901155
protected function getXStream($path)
    {
        if ($this->getFilesystem()->has($path)) {
            trigger_error('fopen(): failed to open stream: File exists', E_USER_WARNING);

            return false;
        }

        $this->needsFlush = true;

        return fopen('php://temp', 'w+b');
    }
265880
public function getFile(string $path): File {
    if($this->isDir($path)) {
      throw new NotAFileException($path);
    }

    return $this->instantiateFile($path);
  }