<!--
{
  "availability" : [
    "macOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FSKit",
  "identifier" : "/documentation/FSKit/FSVolume/XattrHandler/getXattr(named:of:context:replyHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "FSKit"
    ],
    "preciseIdentifier" : "c:objc(pl)FSVolumeXattrHandler(im)getXattrNamed:ofItem:context:replyHandler:"
  },
  "title" : "getXattr(named:of:context:replyHandler:)"
}
-->

# getXattr(named:of:context:replyHandler:)

Gets the specified extended attribute of the given item.

```
func getXattr(named name: FSFileName, of item: FSItem, context: FSContext, replyHandler reply: @escaping @Sendable (FSGetXattrResult?, (any Error)?) -> Void)
```

```
func xattr(named name: FSFileName, of item: FSItem, context: FSContext) async throws -> FSGetXattrResult
```

## Parameters

`name`

The extended attribute name.

`item`

The item for which to get the extended attribute.

`context`

An object that enables context-aware file system decisions throughout the operation.

`reply`

A block or closure to indicate success or failure. If getting the attribute succeeds, pass an instance of [`FSGetXattrResult`](/documentation/FSKit/FSGetXattrResult) containing the extended attribute data, along with a `nil` error. If getting the attribute fails, pass the relevant error as the second parameter; FSKit ignores the [`FSGetXattrResult`](/documentation/FSKit/FSGetXattrResult) instance in this case. For an `async` Swift implementation, there’s no reply handler; simply return the result instance or throw an error.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)