---
title: "init(fileAtPath:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/inputstream/init(fileatpath:)"
---

# init(fileAtPath:)

Initializes and returns an NSInputStream object that reads data from the file at a given path.

## Declaration

```swift
convenience init?(fileAtPath path: String)
```

## Parameters

- `path`: The path to the file.

## Return Value

Return Value An initialized NSInputStream object that reads data from the file at path.

## Discussion

Discussion The stream must be opened before it can be used.

## See Also

### Creating Streams

- [init(data:)](foundation/inputstream/init(data:).md)
- [init(url:)](foundation/inputstream/init(url:)-1lfmj.md)
