<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppleArchive",
  "identifier" : "/documentation/AppleArchive/ArchiveByteStream/fileStream(fd:automaticClose:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Apple Archive",
      "AppleArchive"
    ],
    "preciseIdentifier" : "s:12AppleArchive0B10ByteStreamC04fileD02fd14automaticCloseACSg6System14FileDescriptorV_SbtFZ"
  },
  "title" : "fileStream(fd:automaticClose:)"
}
-->

# fileStream(fd:automaticClose:)

Creates a stream from an open file descriptor.

```
static func fileStream(fd: FileDescriptor, automaticClose: Bool = true) -> ArchiveByteStream?
```

## Parameters

`fd`

The file descriptor that you have previously opened with `open(2)`.

`automaticClose`

A Boolean value that specifies whether to close the file descriptor when you close the stream.

## Return Value

A new archive byte stream.

---

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)