---
title: availableData
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/filehandle/availabledata
---

# availableData

The data currently available in the receiver.

## Declaration

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

## Discussion

Discussion The data currently available through the receiver, up to the maximum size that can be represented by an 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

### Related Documentation

- [readData(ofLength:)](foundation/filehandle/readdata(oflength:).md)
- [readDataToEndOfFile()](foundation/filehandle/readdatatoendoffile().md)

### Reading from a file handle synchronously

- [readToEnd()](foundation/filehandle/readtoend().md)
- [read(upToCount:)](foundation/filehandle/read(uptocount:).md)
