Module:File/doc
From Neodyland Wiki
More actions
This is the documentation page for Module:File
Scope
File title and file information. If the code here grows beyond a border line, this should be converted to an interface and the processing code should be outsourced.
Usage
From Wikitext
Search (Template:Key press) for @exports.
- Examples:
{{#invoke:File|extension|file=File:Test.jpg}}→jpg{{#invoke:File|width|file=File:Test.jpg}}→3120{{#invoke:File|dateWorkCreated|file=File:Ballot-sprite.png}}→{{#invoke:File|fileExists|file=File:Ballot-sprite.png}}→true
From Lua
local file = require( 'Module:File' )
local fileObj = file.File( 'Foo.bar.svg' )
local withoutExtension = fileObj.woExtension()
-- withoutExtension is now 'Foo.bar'
local exists = file.metadata().exists
if exists then
mw.log( file.metadata().width )
end