<!--
{
  "availability" : [
    "macOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FSKit",
  "identifier" : "/documentation/FSKit/FSVolume/KernelOffloadedIOHandler/completeIO(for:offset:length:status:flags:operationID:replyHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "FSKit"
    ],
    "preciseIdentifier" : "c:objc(pl)FSVolumeKernelOffloadedIOHandler(im)completeIOForFile:offset:length:status:flags:operationID:replyHandler:"
  },
  "title" : "completeIO(for:offset:length:status:flags:operationID:replyHandler:)"
}
-->

# completeIO(for:offset:length:status:flags:operationID:replyHandler:)

Completes an I/O operation for a given file.

```
func completeIO(for file: FSItem, offset: off_t, length: Int, status: any Error, flags: FSCompleteIOFlags, operationID: FSOperationID, replyHandler reply: @escaping @Sendable (FSCompleteIOResult?, (any Error)?) -> Void)
```

```
func completeIO(for file: FSItem, offset: off_t, length: Int, status: any Error, flags: FSCompleteIOFlags, operationID: FSOperationID) async throws -> FSCompleteIOResult
```

## Parameters

`file`

The file for which the I/O operation completed.

`offset`

The starting logical offset at which I/O started.

`length`

The length of the I/O range (in bytes).

`status`

Any error that occurred during the operation. If no error occurred, this parameter is `nil`.

`flags`

Flags that affect the behavior of the complete I/O operation.

`operationID`

A unique identifier of the blockmap call. Any value other than `0` (Objective-C) or [`unspecified`](/documentation/FSKit/FSOperationID/unspecified) (Swift) corresponds to a previous call to [`blockmapFile(_:offset:length:flags:operationID:packer:replyHandler:)`](/documentation/FSKit/FSVolume/KernelOffloadedIOHandler/blockmapFile(_:offset:length:flags:operationID:packer:replyHandler:)) with the same `operationID`.

`reply`

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

## Discussion

Implement this method by updating a file’s metadata, such as its size and modification time.

FSKit may call this method without an earlier call to [`blockmapFile(_:offset:length:flags:operationID:packer:replyHandler:)`](/documentation/FSKit/FSVolume/KernelOffloadedIOHandler/blockmapFile(_:offset:length:flags:operationID:packer:replyHandler:)).
In this case, the `operationID` is `0` (Objective-C) or [`unspecified`](/documentation/FSKit/FSOperationID/unspecified) (Swift).

---

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)