<!--
{
  "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/ArchiveHeader/init(keySet:directory:path:flags:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Apple Archive"
    ],
    "preciseIdentifier" : "s:12AppleArchive0B6HeaderC6keySet9directory4path5flagsACSgAC08FieldKeyE0C_6System8FilePathVAmA0B5FlagsVtcfc"
  },
  "title" : "init(keySet:directory:path:flags:)"
}
-->

# init(keySet:directory:path:flags:)

Creates a new archive header with fields derived from the filesystem object, at the specified directory and path.

```
init?(keySet: ArchiveHeader.FieldKeySet, directory: FilePath, path: FilePath, flags: ArchiveFlags)
```

## Parameters

`keySet`

The fields that the new header includes.

`directory`

The base directory of the filesystem object.

`path`

The path, relative to `directory`, to the target filesystem object.

`flags`

Flags that control the behavior of the operation.

---

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)