Contents

setXattr(named:to:on:policy: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, replyHandler reply: @escaping  @Sendable ((any Error)?) -> Void)
func setXattr(named name: FSFileName, to value: Data?, on item: FSItem, policy: FSVolume.SetXattrPolicy) async throws

Parameters

  • 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.

  • reply:

    A block or closure to indicate success or failure. If setting the attribute fails, pass an error as the one parameter to the reply handler. If setting the attribute succeeds, pass nil. For an async Swift implementation, there’s no reply handler; simply throw an error or return normally.

See Also

Reading and writing