hammerspoon2-docs
    Preparing search index...

    Function attributes

    • Get metadata attributes for a file or directory.

      Does not follow symbolic links. Use isSymlink to detect links before calling this if needed.

      Returns an object with:

      • size — Size in bytes (number).
      • type — One of "file", "directory", "symlink", "socket", "characterSpecial", "blockSpecial", or "unknown".
      • permissions — POSIX permission bits as an integer (e.g. 0o644 = 420).
      • ownerID — Owner UID.
      • groupID — Owner GID.
      • inode — Inode number.
      • creationDate — Creation date as seconds since the Unix epoch.
      • modificationDate — Last modification date as seconds since the Unix epoch.

      Parameters

      • path: string

        Path to inspect. ~ is expanded.

      Returns Record<string, any> | null

      Attributes object, or null if the path cannot be accessed.