---
title: "getAttributes(_:of:context:replyHandler:)"
framework: fskit
role: symbol
role_heading: Instance Method
path: "fskit/fsvolume/handler/getattributes(_:of:context:replyhandler:)"
---

# getAttributes(_:of:context:replyHandler:)

Fetches attributes for the given item.

## Declaration

```swift
func getAttributes(_ desiredAttributes: FSItem.GetAttributesRequest, of item: FSItem, context: FSContext, replyHandler reply: @escaping @Sendable (FSGetAttributesResult?, (any Error)?) -> Void)
```

```swift
func attributes(_ desiredAttributes: FSItem.GetAttributesRequest, of item: FSItem, context: FSContext) async throws -> FSGetAttributesResult
```

## Parameters

- `desiredAttributes`: A requested set of attributes to get. The implementation inspects the request’s doc://FSKit/documentation/FSKit/FSItem/GetAttributesRequest/wantedAttributes to determine which attributes to populate.
- `item`: The item to get attributes for.
- `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 attributes succeeds, pass an instance of doc://FSKit/documentation/FSKit/FSGetAttributesResult containing the requested attributes, along with a nil error. If getting attributes fails, pass the relevant error as the second parameter; FSKit ignores the doc://FSKit/documentation/FSKit/FSGetAttributesResult instance in this case. For an async Swift implementation, there’s no reply handler; simply return the result instance or throw an error.

## Discussion

Discussion For file systems that don’t support hard links, set linkCount to 1 for regular files and symbolic links. If the item’s bsdFlags contain the UF_COMPRESSED flag, your file system returns the uncompressed size of the file.

## See Also

### Working with attributes

- [FSItem.GetAttributesRequest](fskit/fsitem/getattributesrequest.md)
- [FSGetAttributesResult](fskit/fsgetattributesresult.md)
- [setAttributes(_:on:context:replyHandler:)](fskit/fsvolume/handler/setattributes(_:on:context:replyhandler:).md)
- [FSItem.SetAttributesRequest](fskit/fsitem/setattributesrequest.md)
- [FSSetAttributesResult](fskit/fssetattributesresult.md)
