src/Composer/Util/Filesystem.php
public function size($path)
    {
        if (!file_exists($path)) {
            throw new \RuntimeException("$path does not exist.");
        }
        if (is_dir($path)) {
            return $this->directorySize($path);
        }

        return filesize($path);
    }
public function size($path)
    {
        if (!file_exists($path)) {
            throw new \RuntimeException("$path does not exist.");
        }
        if (is_dir($path)) {
            return $this->directorySize($path);
        }

        return filesize($path);
    }
Returns size of a file or directory specified by path. If a directory is
given, it's size will be computed recursively.

@param  string            $path Path to the file or directory
@throws \RuntimeException
@return int