<!--
{
  "availability" : [
    "macOS: 15.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FSKit",
  "identifier" : "/documentation/FSKit/FSDirectoryEntryPacker/packEntry(name:itemType:itemID:nextCookie:attributes:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "FSKit"
    ],
    "preciseIdentifier" : "c:objc(cs)FSDirectoryEntryPacker(im)packEntryWithName:itemType:itemID:nextCookie:attributes:"
  },
  "title" : "packEntry(name:itemType:itemID:nextCookie:attributes:)"
}
-->

# packEntry(name:itemType:itemID:nextCookie:attributes:)

Provides a directory entry during enumeration.

```
func packEntry(name: FSFileName, itemType: FSItem.ItemType, itemID: FSItem.Identifier, nextCookie: FSDirectoryCookie, attributes: FSItem.Attributes?) -> Bool
```

## Parameters

`name`

The item’s name.

`itemType`

The type of the item.

`itemID`

The item’s identifier. Typically this is an inode number, or one of the constants defined by [`FSItem.Identifier`](/documentation/FSKit/FSItem/Identifier) like [`FSItem.Identifier.rootDirectory`](/documentation/FSKit/FSItem/Identifier/rootDirectory).

`nextCookie`

A value to indicate the next entry in the directory to enumerate. FSKit passes this value as the `cookie` parameter on the next call to [`enumerateDirectory(_:startingAt:verifier:attributes:packer:context:replyHandler:)`](/documentation/FSKit/FSVolume/Handler/enumerateDirectory(_:startingAt:verifier:attributes:packer:context:replyHandler:)). Use whatever value is appropriate for your implementation; the value is opaque to FSKit.

`attributes`

The item’s attributes. Pass `nil` if the enumeration call didn’t request attributes.

## Return Value

`true` (Swift) or `YES` (Objective-C) if packing was successful and enumeration can continue with the next directory entry. If the value is `false` (Swift) or `NO` (Objective-C), stop enumerating. This result can happen when the entry is too big for the remaining space in the buffer.

## Discussion

You call this method in your implementation of [`enumerateDirectory(_:startingAt:verifier:attributes:packer:context:replyHandler:)`](/documentation/FSKit/FSVolume/Handler/enumerateDirectory(_:startingAt:verifier:attributes:packer:context:replyHandler:)), for each directory entry you want to provide to the enumeration.

---

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)