Module:FileSize
From Tsadra Commons
Documentation for this module may be created at Module:FileSize/doc
local p = {}
function p.bytes(frame)
local name = frame.args[1] or ''
local title = mw.title.new(name)
if title and title.file and title.file.exists then
return title.file.size
end
return ''
end
function p.kb(frame)
local name = frame.args[1] or ''
local title = mw.title.new(name)
if title and title.file and title.file.exists then
return string.format('%.1f', title.file.size / 1024)
end
return ''
end
return p