---
title: "openItem(_:modes:context:replyHandler:)"
framework: fskit
role: symbol
role_heading: Instance Method
path: "fskit/fsvolume/openclosehandler/openitem(_:modes:context:replyhandler:)"
---

# openItem(_:modes:context:replyHandler:)

Opens a file for access.

## Declaration

```swift
func openItem(_ item: FSItem, modes: FSVolume.OpenModes, context: FSContext, replyHandler reply: @escaping @Sendable ((any Error)?) -> Void)
```

```swift
func openItem(_ item: FSItem, modes: FSVolume.OpenModes, context: FSContext) async throws
```

## Parameters

- `item`: The item to open.
- `modes`: The set of mode flags to open the item with.
- `context`: An object that enables context-aware file system decisions throughout the operation.
- `reply`: A block or closure to indicate success or failure. If opening fails, pass an error as the one parameter to the reply handler. If opening succeeds, pass nil. For an async Swift implementation, there’s no reply handler; simply throw an error or return normally.

## See Also

### Opening and closing

- [closeItem(_:modes:context:replyHandler:)](fskit/fsvolume/openclosehandler/closeitem(_:modes:context:replyhandler:).md)
- [FSVolume.OpenModes](fskit/fsvolume/openmodes.md)
- [FSContext](fskit/fscontext.md)
