Contents

FileHandle.AsyncBytes

An asynchronous sequence of bytes.

Declaration

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 characters, unicodeScalars, or lines properties to retrieve the contents in a more convenient format. Since all of these properties conform to AsyncSequence, as does the FileHandle property bytes, you can use methods defined by 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

Structures

See Also

Reading from a File Handle Asynchronously