Get a file's size.

@param string $path The path to the file.

@throws FileNotFoundException

@return int|false The file size or false on failure.
163487
public function getSize($path)
    {
        list($prefix, $path) = $this->getPrefixAndPath($path);

        return $this->getFilesystem($prefix)->getSize($path);
    }
265880
public function getFile(string $path): File {
    if($this->isDir($path)) {
      throw new NotAFileException($path);
    }

    return $this->instantiateFile($path);
  }
796198
protected function countSize($path) {
		$stat = $this->stat($path);

		if (empty($stat) || !$stat['read'] || !empty($stat['hidden'])) {
			return 'unknown';
		}
		
		if ($stat['mime'] != 'directory') {
			return $stat['size'];
		}
		
		$subdirs = $this->options['checkSubfolders'];
		$this->options['checkSubfolders'] = true;
		$result = 0;
		foreach ($this->getScandir($path) as $stat) {
			$size = $stat['mime'] == 'directory' && $stat['read'] 
				? $this->countSize($this->joinPathCE($path, $stat['name'])) 
				: (isset($stat['size']) ? intval($stat['size']) : 0);
			if ($size > 0) {
				$result += $size;
			}
		}
		$this->options['checkSubfolders'] = $subdirs;
		return $result;
	}
1068140
protected function getContents(/*# string */ $path)/*# string */
    {
        // read in file
        $contents = @file_get_contents($path);

        // failed
        if (false === $contents) {
            throw new NotFoundException(
                Message::get(Message::CONFIG_FILE_NOTFOUND, $path),
                Message::CONFIG_FILE_NOTFOUND
            );
        }
        return $contents;
    }
227018
public function read( $path )
	{
		try {
			return $this->fs->get( $path );
		} catch( \Exception $e ) {
			throw new Exception( $e->getMessage(), 0, $e );
		}
	}
3278
public function isEmpty(string $path): bool
	{
		if(is_dir($path))
		{
			return (new FilesystemIterator($path))->valid() === false;
		}

		return filesize($path) === 0;
	}
397584
protected function get_imageinfo_from_path($path) {
        $imageinfo = getimagesize($path);

        $image = array(
                'width'     => $imageinfo[0],
                'height'    => $imageinfo[1],
                'mimetype'  => image_type_to_mime_type($imageinfo[2]),
            );
        if (empty($image['width']) or empty($image['height']) or empty($image['mimetype'])) {
            // GD can not parse it, sorry.
            return false;
        }
        return $image;
    }
878869
static function GetFileSystemEntryType($path)
    {
        if (is_file($path))
            return FileSystemEntryType::File();
        else if (is_link($path))
            return FileSystemEntryType::Link();
        else if (is_dir($path))
            return FileSystemEntryType::Folder();
        else
            throw new Exceptions\PathNotFoundException("Path $path not found");
    }
388628
public static function size($path)
    {
        $path = Normalize::diskFullPath($path);

        if (!self::exist($path)) {
            return 0;
        }

        return filesize($path);
    }
1023108
public static function dirsize(string $path) {
		$size = 0;
		$files = static::scandir($path, true, false);
		foreach ($files as $v) {
			$size += @\filesize($v);
		}
		return $size;
	}
1277476
public function calcDiskSize($path, $bytes = 0)
    {
        if ($this->plugin['files']->exists($path)) {
            if ($this->plugin['files']->isDirectory($path)) {
                foreach ($this->plugin['files']->glob($path) as $file) {
                    $bytes += $this->plugin['files']->size($file);
                }
            } else {
                $bytes += $this->plugin['files']->size($path);
            }
        }
        $units = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];
        for ($i = 0; $bytes > 1024; $i++) {
            $bytes /= 1024;
        }
        $size = round($bytes, 2);
        return ($size == 0 ? '-' : $size . ' ' . $units[$i]);
    }
874103
protected function countSize($path) {
		$stat = $this->stat($path);

		if (empty($stat) || !$stat['read'] || !empty($stat['hidden'])) {
			return 'unknown';
		}
		
		if ($stat['mime'] != 'directory') {
			return $stat['size'];
		}
		
		$subdirs = $this->options['checkSubfolders'];
		$this->options['checkSubfolders'] = true;
		$result = 0;
		foreach ($this->getScandir($path) as $stat) {
			$size = $stat['mime'] == 'directory' && $stat['read'] 
				? $this->countSize($this->_joinPath($path, $stat['name'])) 
				: $stat['size'];
			if ($size > 0) {
				$result += $size;
			}
		}
		$this->options['checkSubfolders'] = $subdirs;
		return $result;
	}
266134
public function read($path)
    {
        $contents = file_get_contents($this->applyPathPrefix($path));

        return $contents !== false ? compact('contents') : false;
    }
612729
protected function getFolderItemCount($path)
    {
        $folderItems = array_merge(
            $this->getStorageDisk()->files($path),
            $this->getStorageDisk()->directories($path)
        );

        $size = 0;
        foreach ($folderItems as $folderItem) {
            if ($this->isVisible($folderItem)) {
                $size++;
            }
        }

        return $size;
    }
554953
protected function _findPath($path)
    {
        $path = $this->_unifyPath($path);
        $dirs = $this->_dirs;

        $file = null;

        foreach ($dirs as $dir) {
            if (is_readable(realpath($dir.DS.$path))) {
                $file = $dir.DS.$path;
                break;
            }
        }

        return $file;
    }
834183
public function get( string $path, bool $lock = false )
	{
		if( $this->isFile( $path ) )
		{
			return $lock ? $this->sharedGet( $path ) : file_get_contents( $path );
		}
		throw new NotFoundFileException($path, "File does not exist at path '{$path}'");
	}
86005
private function load_file( $path ) {
		if ( $path && is_readable( $path ) ) {
			include_once( $path );
			$success = true;
		}

		return ! ( empty( $success ) ) ? true : false;
	}