<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/FileHandle/availableData",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSFileHandle(py)availableData"
  },
  "title" : "availableData"
}
-->

# availableData

The data currently available in the receiver.

```
var availableData: Data { get }
```

## Discussion

The data currently available through the receiver, up to the maximum size that can be represented by an [`NSData`](/documentation/Foundation/NSData) object.

If the receiver is a file, this method returns the data obtained by reading the file from the current file pointer to the end of the file. If the receiver is a communications channel, this method reads up to a buffer of data and returns it; if no data is available, the method blocks. Returns an empty data object if the end of file is reached. This method raises `NSFileHandleOperationException` if attempts to determine the file-handle type fail or if attempts to read from the file or channel fail.

## See Also

[`-  readDataOfLength:`](/documentation/Foundation/FileHandle/readData(ofLength:))

Reads data synchronously up to the specified number of bytes.

[`-  readDataToEndOfFile`](/documentation/Foundation/FileHandle/readDataToEndOfFile())

Reads the available data synchronously up to the end of file or maximum number of bytes.



---

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)