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:
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.
Signature | hs.fs.xattr.get(path, attribute, [options], [position]) -> string | true | nil |
---|---|
Type | Function |
Description | Set the extended attribute to the value provided for the path specified. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/fs/libfs_xattr.m line 156 |
Signature | hs.fs.xattr.getHumanReadable(path, attribute, [options], [position]) -> string | true | nil |
---|---|
Type | Function |
Description | A wrapper to hs.fs.xattr.get which returns non UTF-8 data as a hexadecimal dump provided by |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/fs/fs.lua line 11 |
Signature | hs.fs.xattr.list(path, [options]) -> table |
---|---|
Type | Function |
Description | Returns a list of the extended attributes currently defined for the specified file or directory |
Parameters |
|
Returns |
|
Source | extensions/fs/libfs_xattr.m line 208 |
Signature | hs.fs.xattr.remove(path, attribute, [options]) -> boolean |
---|---|
Type | Function |
Description | Removes the specified extended attribute from the file or directory at the path specified. |
Parameters |
|
Returns |
|
Source | extensions/fs/libfs_xattr.m line 126 |
Signature | hs.fs.xattr.set(path, attribute, value, [options], [position]) -> boolean |
---|---|
Type | Function |
Description | Set the extended attribute to the value provided for the path specified. |
Parameters |
|
Returns |
|
Source | extensions/fs/libfs_xattr.m line 87 |