<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/FileHandle/AsyncBytes",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:So12NSFileHandleC10FoundationE10AsyncBytesV"
  },
  "title" : "FileHandle.AsyncBytes"
}
-->

# FileHandle.AsyncBytes

An asynchronous sequence of bytes.

```
struct AsyncBytes
```

## Overview

Use the `for`-`await`-`in` syntax to iterate over the bytes in this sequence. For text files, you can also use its <doc://com.apple.documentation/documentation/Swift/AsyncSequence/characters>, <doc://com.apple.documentation/documentation/Swift/AsyncSequence/unicodeScalars>, or <doc://com.apple.documentation/documentation/Swift/AsyncSequence/lines> properties to retrieve the contents in a more convenient format. Since all of these properties conform to <doc://com.apple.documentation/documentation/Swift/AsyncSequence>, as does the [`FileHandle`](/documentation/Foundation/FileHandle) property [`bytes`](/documentation/Foundation/FileHandle/bytes), you can use methods defined by <doc://com.apple.documentation/documentation/Swift/AsyncSequence> to perform powerful inline processing. For example, you can skip the first `n` bytes of the file with `myFileHandle.bytes.prefix(n)`.

## Topics

### Adapting Textual Sequences

[`AsyncCharacterSequence`](/documentation/Foundation/AsyncCharacterSequence)

An asynchronous sequence of characters.

[`AsyncUnicodeScalarSequence`](/documentation/Foundation/AsyncUnicodeScalarSequence)

An asychronous sequence of Unicode scalar values.

[`AsyncLineSequence`](/documentation/Foundation/AsyncLineSequence)

An asynchronous sequence of lines of text.

### Finding Elements

### Selecting Elements

### Excluding Elements

### Transforming a Sequence

### Creating an Iterator

[`makeAsyncIterator()`](/documentation/Foundation/FileHandle/AsyncBytes/makeAsyncIterator())

Creates the asynchronous iterator that produces elements of this asynchronous sequence.

### Supporting Types



---

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)