---
title: "read(into:startingAt:length:)"
framework: fskit
role: symbol
role_heading: Instance Method
path: "fskit/fsblockdeviceresource/read(into:startingat:length:)-5yozi"
---

# read(into:startingAt:length:)

Asychronously reads data from the resource into a buffer.

## Declaration

```swift
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

Return Value The actual number of bytes read.

## Discussion

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. note: An error describing any read error. This value is EFAULT if buffer is NULL, or errno if reading from the resource failed.

## See Also

### Reading and writing data

- [read(into:startingAt:length:)](fskit/fsblockdeviceresource/read(into:startingat:length:)-4ax6s.md)
- [read(into:startingAt:length:completionHandler:)](fskit/fsblockdeviceresource/read(into:startingat:length:completionhandler:).md)
- [write(from:startingAt:length:)](fskit/fsblockdeviceresource/write(from:startingat:length:)-2fmgt.md)
- [write(from:startingAt:length:)](fskit/fsblockdeviceresource/write(from:startingat:length:)-9oa1x.md)
- [write(from:startingAt:length:completionHandler:)](fskit/fsblockdeviceresource/write(from:startingat:length:completionhandler:).md)
