Stat

Undocumented

  • Creates a Stat instance with fstat located in Darwin library. Internal uses fstat to extract Stat information from specific file descriptor.

    Declaration

    Swift

    public init(_ fileno: Int)

    Parameters

    fileno

    A file number

  • Creates a Stat instance with stat located in Darwin library. Internal uses stat to extract Stat information from specific path.

    Declaration

    Swift

    public init(_ path: String)

    Parameters

    path

    A file path.

  • Returns the last access time for this file as an object of class Date.

    Declaration

    Swift

    public var atime: Date
  • Returns the birth time for stat.

    Declaration

    Swift

    public var birthtime: Date
  • Returns the native file system’s block size.

    Declaration

    Swift

    public var blksize: Int
  • Returns the number of native file system blocks allocated for this file.

    Declaration

    Swift

    public var blocks: Int
  • Returns the change time for stat (that is, the time directory information about the file was changed, not the file itself).

    Declaration

    Swift

    public var ctime: Date
  • dev

    Returns an integer representing the device on which stat resides.

    Declaration

    Swift

    public var dev: Int
  • gid

    Returns the numeric group id of the owner of stat.

    Declaration

    Swift

    public var gid: Int
  • Returns true if the effective group id of the process is the same as the group id of stat.

    Declaration

    Swift

    public var isGroupOwned: Bool
  • ino

    Returns the inode number for stat.

    Declaration

    Swift

    public var ino: Int
  • Returns an integer representing the permission bits of stat.

    Declaration

    Swift

    public var mode: Int
  • Returns the modification time of stat.

    Declaration

    Swift

    public var mtime: Date
  • Returns the number of hard links to stat.

    Declaration

    Swift

    public var nlink: Int
  • Returns true if the effective user id of the process is the same as the owner of stat.

    Declaration

    Swift

    public var isOwned: Bool
  • Returns an integer representing the device type on which stat resides.

    Declaration

    Swift

    public var rdev: Int
  • Returns the size of stat in bytes.

    Declaration

    Swift

    public var size: Int
  • uid

    Returns the numeric user id of the owner of stat.

    Declaration

    Swift

    public var uid: Int
  • Returns true if stat is a zero-length file; false otherwise.

    Declaration

    Swift

    public var isZero: Bool
  • Returns true if stat has the set-group-id permission bit set, false if it doesn’t or if the operating system doesn’t support this feature.

    Declaration

    Swift

    public var isSetgid: Bool
  • Returns true if stat has the set-user-id permission bit set, false if it doesn’t or if the operating system doesn’t support this feature.

    Declaration

    Swift

    public var isSetuid: Bool
  • Returns true if stat has its sticky bit set, false if it doesn’t or if the operating system doesn’t support this feature.

    Declaration

    Swift

    public var isSticky: Bool
  • Returns true if the file is a block device, false if it isn’t or if the operating system doesn’t support this feature.

    Declaration

    Swift

    public var isBlockDev: Bool
  • Returns true if the file is a character device, false if it isn’t or if the operating system doesn’t support this feature.

    Declaration

    Swift

    public var isCharDev: Bool
  • Returns true if stat is a regular file (not a device file, pipe, socket, etc.).

    Declaration

    Swift

    public var isFile: Bool
  • Returns true if the named file is a directory, or a symlink that points at a directory, and false otherwise.

    Declaration

    Swift

    public var isDirectory: Bool
  • Returns true if the operating system supports pipes and stat is a pipe; false otherwise.

    Declaration

    Swift

    public var isPipe: Bool
  • Returns true if stat is a socket, false if it isn’t or if the operating system doesn’t support this feature.

    Declaration

    Swift

    public var isSocket: Bool
  • Returns true if stat is a symbolic link, false if it isn’t or if the operating system doesn’t support this feature.

    Declaration

    Swift

    public var isSymlink: Bool
  • Identifies the type of the named file; the return string is one of file, directory, characterSpecial, blockSpecial, fifo, link, socket, or unknown.

    Declaration

    Swift

    public var ftype: String
  • A textual representation of this instance.

    Instead of accessing this property directly, convert an instance of any type to a string by using the String(describing:) initializer. For example:

    struct Point: CustomStringConvertible {
        let x: Int, y: Int
    
        var description: String {
            return "(\(x), \(y))"
        }
    }
    
    let p = Point(x: 21, y: 30)
    let s = String(describing: p)
    print(s)
    // Prints "(21, 30)"
    

    The conversion of p to a string in the assignment to s uses the Point type’s description property.

    Declaration

    Swift

    public var description: String
  • Produce a nicely formatted description of stat.

    Declaration

    Swift

    public var inspect: String