<!--
{
  "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/InputStream/init(fileAtPath:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSInputStream(im)initWithFileAtPath:"
  },
  "title" : "init(fileAtPath:)"
}
-->

# init(fileAtPath:)

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

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

## Parameters

`path`

The path to the file.

## Return Value

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

## Discussion

The stream must be opened before it can be used.

## See Also

[`inputStreamWithFileAtPath:`](/documentation/Foundation/NSInputStream/inputStreamWithFileAtPath:)

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



---

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)