<!--
{
  "availability" : [
    "macOS: 15.4.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "FSKit",
  "identifier" : "/documentation/FSKit/FSVolumeKernelOffloadedIOOperations/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)FSVolumeKernelOffloadedIOOperations(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 ((any Error)?) -> Void)
```

## 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:)` with the same `operationID`.

`reply`

A block or closure to indicate success or failure. If completing I/O fails, pass an error as the one parameter to the reply handler. If completing I/O succeeds, pass `nil`. For an `async` Swift implementation, there’s no reply handler; simply throw an error or return normally.

## 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:)`.
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)