Returns the size of the given (remote) filename.
2565
def size(filename)
      voidcmd("TYPE I")
      resp = sendcmd("SIZE " + filename)
      if resp[0, 3] != "213" 
	raise FTPReplyError, resp
      end
      return resp[3..-1].strip.to_i
    end
1323187
def str_with_sizes(self, max_name, max_remote_id, max_size):
        
        name_str = self.name.ljust(max_name)
        remote_id_str = self.remote_id.ljust(max_remote_id)
        size_str = self.size.ljust(max_size)
        return u'{}    {}    {}    {}'.format(name_str, remote_id_str, size_str, self.file_hash)
507572
def file_size(self, name, force_refresh=False):
        

        uname, version = split_name(name)

        t = time.time()
        logger.debug('    querying size of %s', name)
        try:
            if not self.remote_store or (version is not None
                                         and not force_refresh):
                try:
                    if self.local_store and self.local_store.exists(name):
                        return self.local_store.file_size(name)
                except Exception:
                    if self.remote_store:
                        logger.warning("Error getting '%s' from local store",
                                       name, exc_info=True)
                    else:
                        raise
            if self.remote_store:
                return self.remote_store.file_size(name)
            raise FiletrackerError("File not available: %s" % name)
        finally:
            logger.debug('    processed %s in %.2fs', name, time.time() - t)
81928
public static function getSize($filename) {
        if (false === file_exists($filename)) {
            throw new FileNotFoundException($filename);
        }
        clearstatcache();
        return filesize($filename);
    }
961683
def get_file_size(filename):
    
    if filename is None:
        return float(0)
    if type(filename) is list:
        return float(sum([get_file_size(x) for x in filename]))
    try:
        total_bytes = sum([float(os.stat(f).st_size)
                           for f in filename.split(" ") if f is not ''])
    except OSError:
        # File not found
        return 0.0
    else:
        return float(total_bytes) / (1024 ** 3)
93865
def file_size(filename):
    '''
    
    '''
    # Using open/lseek works on both regular files and block devices
    fd = os.open(filename, os.O_RDONLY)
    try:
        return os.lseek(fd, 0, os.SEEK_END)
    except KeyboardInterrupt as e:
        raise e
    except Exception as e:
        raise Exception(
            "file_size failed to obtain the size of '%s': %s" % (filename, str(e)))
    finally:
        os.close(fd)
473247
def filesize(self):
        """"""
        if self.kind == 'data':
            return len(self._data.data)
        return self._data.filesize
55055
function getFileSize(filepath, options) {
			var stats = fs.statSync(filepath);
			return filesize(stats.size, options);
		}
1373239
public static function get_remote_filesize($url, $maxredirs = 2) {
		$parts = parse_url($url);
		if (empty($parts['host'])) {
			return false;
		}

		if ($parts['scheme'] === 'https') {
			$host = 'ssl://'.$parts['host'];
			$port = (isset($parts['port'])) ? $parts['port'] : 443;
		} else {
			$host = $parts['host'];
			$port = (isset($parts['port'])) ? $parts['port'] : 80;
		}
		$errno = $errstr = '';
		$timeout = 30;

		try {
			$fp = @fsockopen($host, $port, $errno, $errstr, $timeout);
		} catch (\Exception $e) {
			return false;
		}
		if (empty($fp)) {
			return false;
		}

		$path = $parts['path'];
		if (!empty($parts['query'])) {
			$path .= '?'.$parts['query'];
		}

		$out = 'HEAD '.$path.' HTTP/1.1'."\r\n"
			.'Host: '.$parts['host']."\r\n"
			.'Connection: Close'."\r\n\r\n";

		fwrite($fp, $out);
		$headers = '';
		while (!@feof($fp)) {
			$headers .= @fgets($fp, 128);
		}
		fclose($fp);

		$return = false;
		$headers = explode("\n", $headers);
		foreach ($headers as $header) {
			$hparts = explode(':', mb_strtolower($header), 2);
			if (!isset($hparts[1])) {
				continue;
			}
			list($hkey, $hval) = $hparts;
			switch ($hkey) {
				case 'location':
					if ($maxredirs > 0) {
						return static::get_remote_filesize(trim($hval), ($maxredirs - 1));
					} else {
						return false;
					}

				case 'content-length':
					return (int)trim($hval);
			}
		}
	}
542269
function size($filename)
    {
        if (!($this->bitmap & SSH2::MASK_LOGIN)) {
            return false;
        }

        $result = $this->stat($filename);
        if ($result === false) {
            return false;
        }
        return isset($result['size']) ? $result['size'] : -1;
    }
1013909
def file_length(in_file):
    ''''''

    fid = open(in_file)
    data = fid.readlines()
    fid.close()
    return len(data)
1219229
def size(filename)
      with_binary(true) do
        resp = sendcmd("SIZE " + filename)
        if resp[0, 3] != "213"
          raise FTPReplyError, resp
        end
        return resp[3..-1].strip.to_i
      end
    end
1038299
def file_sizes(self):
        """"""
        size = sum(map(os.path.getsize, self.file_list))
        return size / 1024 / 1024
484962
function size($filename)
    {
        if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) {
            return false;
        }

        $result = $this->stat($filename);
        if ($result === false) {
            return false;
        }
        return isset($result['size']) ? $result['size'] : -1;
    }
66839
def _getImageSize(filename):
    """"""
    result = None
    file = open(filename, 'rb')
    if file.read(8) == b'\x89PNG\r\n\x1a\n': # PNG
        while 1:
            length, = _struct.unpack('>i', file.read(4))
            chunkID = file.read(4)
            if chunkID == '': # EOF
                break
            if chunkID == b'IHDR':
                # return width, height
                result = _struct.unpack('>ii', file.read(8))
                break
            file.seek(4 + length, 1)
        file.close()
        return result
    file.seek(0)
    if file.read(8) == b'BM': # Bitmap
        file.seek(18, 0) # skip to size data
        result = _struct.unpack('<ii', file.read(8))
    file.close()
    return result
879154
def do_filesize(self, line):
        
        if len(line) == 0:
            print_err("Must provide a filename")
            return
        filename = resolve_path(line)
        self.print(auto(get_filesize, filename))
865391
def size(self):
        """"""
        old = self.__file.tell()        # old position

        self.__file.seek(0, 2)          # end of file
        n_bytes = self.__file.tell()    # file size in bytes

        self.__file.seek(old)           # back to old position

        return n_bytes