#
hs.fs.xattr
Get and manipulate extended attributes for files and directories
This submodule provides functions for getting and setting the extended attributes for files and directories. Access to extended attributes is provided through the Darwin xattr functions defined in the /usr/include/sys/xattr.h header. Attribute names are expected to conform to proper UTF-8 strings and values are represented as raw data -- in Lua raw data is presented as bytes in a string object but the bytes are not required to conform to proper UTF-8 byte code sequences. This module does not perform any encoding or decoding of the raw data.
All of the functions provided by this module can take an options table. Note that not all options are valid for all functions. The options table should be a Lua table containing an array of zero or more of the following strings:
- "noFollow" - do not follow symbolic links; this can be used to access the attributes of the link itself.
- "hfsCompression" - access HFS Plus Compression extended attributes for the file or directory, if present
- "createOnly" - when setting an attribute value, fail if the attribute already exists
- "replaceOnly" - when setting an attribute value, fail if the attribute does not already exist
Note that the following options did not seem to be valid for the initial tests performed when developing this module and may refer the kernel level features not available to Hammerspoon; they are included here for full compatibility with the library as defined in its header. If you have more information about these options or can provide examples or documentation about their use, please submit an issue to the Hammerspoon github repository so we can provide better documentation here.
- "noSecurity" - bypass authorization checking
- "noDefault" - bypass the default extended attribute file (dot-underscore file)
#
API Overview
Functions - API calls offered directly by the extension
get getHumanReadable list remove set