setXattr(named:to:on:policy:context:replyHandler:)
Sets the specified extended attribute data on the given item.
Declaration
func setXattr(named name: FSFileName, to value: Data?, on item: FSItem, policy: FSVolume.SetXattrPolicy, context: FSContext, replyHandler reply: @escaping @Sendable (FSSetXattrResult?, (any Error)?) -> Void)func setXattr(named name: FSFileName, to value: Data?, on item: FSItem, policy: FSVolume.SetXattrPolicy, context: FSContext) async throws -> FSSetXattrResultParameters
- name:
The extended attribute name.
- value:
The extended attribute value to set. This can’t be
nil, unless the policy is Delete. - item:
The item on which to set the extended attribute.
- policy:
The policy to apply when setting the attribute. See Setxattrpolicy for possible values.
- context:
An object that enables context-aware file system decisions throughout the operation.
- reply:
A block or closure to indicate success or failure. If setting the attribute succeeds, pass an instance of Fssetxattrresult containing the volume’s updated free space, along with a
nilerror. If setting the attribute fails, pass the relevant error as the second parameter; FSKit ignores the Fssetxattrresult instance in this case. For anasyncSwift implementation, there’s no reply handler; simply return the result instance or throw an error.