<!--
{
  "availability" : [
    "macOS: 14.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MediaExtension",
  "identifier" : "/documentation/MediaExtension/MEByteSource/read(length:from:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "MediaExtension"
    ],
    "preciseIdentifier" : "c:objc(cs)MEByteSource(im)readDataOfLength:fromOffset:completionHandler:"
  },
  "title" : "read(length:from:completionHandler:)"
}
-->

# read(length:from:completionHandler:)

Reads bytes from a byte source into a data object.

```
func read(length: Int, from offset: Int64, completionHandler: @escaping @Sendable (Data?, (any Error)?) -> Void)
```

## Parameters

`length`

The number of bytes to read.

`offset`

The relative offset in bytes from the beginning of the file from which to start reading.

`completionHandler`

The completion block to execute when the read operation finishes.

---

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)