---
title: "listXattrs(of:context:replyHandler:)"
framework: fskit
role: symbol
role_heading: Instance Method
path: "fskit/fsvolume/xattrhandler/listxattrs(of:context:replyhandler:)"
---

# listXattrs(of:context:replyHandler:)

Gets the list of extended attributes currently set on the given item.

## Declaration

```swift
func listXattrs(of item: FSItem, context: FSContext, replyHandler reply: @escaping @Sendable (FSListXattrsResult?, (any Error)?) -> Void)
```

```swift
func xattrs(of item: FSItem, context: FSContext) async throws -> FSListXattrsResult
```

## Parameters

- `item`: The item from which to get extended attributes.
- `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 list of extended attributes succeeds, pass an instance of doc://FSKit/documentation/FSKit/FSListXattrsResult containing the xattrs as an array of doc://FSKit/documentation/FSKit/FSFileName instances, along with a nil error. If getting the attributes fails, pass the relevant error as the second parameter; FSKit ignores the doc://FSKit/documentation/FSKit/FSListXattrsResult instance in this case. For an async Swift implementation, there’s no reply handler; simply return the result instance or throw an error.

## See Also

### Reading and writing

- [getXattr(named:of:context:replyHandler:)](fskit/fsvolume/xattrhandler/getxattr(named:of:context:replyhandler:).md)
- [FSGetXattrResult](fskit/fsgetxattrresult.md)
- [FSListXattrsResult](fskit/fslistxattrsresult.md)
- [setXattr(named:to:on:policy:context:replyHandler:)](fskit/fsvolume/xattrhandler/setxattr(named:to:on:policy:context:replyhandler:).md)
- [FSVolume.SetXattrPolicy](fskit/fsvolume/setxattrpolicy.md)
- [FSSetXattrResult](fskit/fssetxattrresult.md)
- [supportedXattrNames(for:)](fskit/fsvolume/xattrhandler/supportedxattrnames(for:).md)
