mirror of
https://github.com/mailscope/kumomta.git
synced 2026-08-19 19:08:17 +00:00
1.7 KiB
1.7 KiB
tags
| tags | ||
|---|---|---|
|
kumo.fs.metadata_for_path
kumo.fs.metadata_for_path(PATH)
{{since('2026.04.09-ea3b2a9b')}}
This function returns the file or directory attributes. If PATH is a symbolic link, this function will traverse symbolic links and retrieves metadata of the destination file or directory. Available attributes are as below.
Not all attributes are guaranteed to be retrievable as they may be platform dependent.
pathsame as supplied pathis_filereturns true if path points to a fileis_dirreturns true if path points to a directoryis_symlinkreturns true if path is for a symbolic linklensize of the filereadonlyreturns true if path permission is set as readonly
The following fields may not be available on all platforms, in such case it will return nil.
devreturns the ID of the device containing the fileinoreturns the inode numbermodereturns the rights applied to this filenlinkreturns the number of hard links pointing to this fileuidreturns the user ID of the owner of this filegidreturns the group ID of the owner of this filerdevreturns the device ID of this filesizereturns the total size of this file in bytesblksizereturns the block size for filesystem I/Oblocksreturns the number of blocks allocated to the file, in 512-byte unitsmtimelast modification time represented inTimeobjectatimelast access time represented inTimeobjectctimecreation time represented inTimeobject
local kumo = require 'kumo'
local ok, metadata = pcall(kumo.fs.metadata_for_path, '/tmp/testfile')
if ok then
print('mtime', metadata.mtime.rfc2822)
else
print('error', metadata)
end