<!--
{
  "availability" : [
    "macOS: 15.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FSKit",
  "identifier" : "/documentation/FSKit/FSBlockDeviceResource/read(into:startingAt:length:)-5yozi",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "FSKit"
    ],
    "preciseIdentifier" : "s:So21FSBlockDeviceResourceC5FSKitE4read4into10startingAt6lengthSiSw_s5Int64VSitYaKF"
  },
  "title" : "read(into:startingAt:length:)"
}
-->

# read(into:startingAt:length:)

Asychronously reads data from the resource into a buffer.

```
func read(into buffer: UnsafeMutableRawBufferPointer, startingAt offset: off_t, length: Int) async throws -> Int
```

## Parameters

`buffer`

A buffer to receive the data.

`offset`

The offset into the resource from which to start reading.

`length`

A maximum number of bytes to read. The completion handler receives a parameter with the actual number of bytes read.

## Return Value

The actual number of bytes read.

## Discussion

For the read to succeed, requests must conform to any transfer requirements of the underlying resource.
Disk drives typically require sector (`physicalBlockSize`) addressed operations of one or more sector-aligned offsets.

> Throws: An error describing any read error. This value is `EFAULT` if `buffer` is `NULL`, or `errno` if reading from the resource failed.

---

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)