---
title: "descriptor(for:searchingInAssetPackWithID:)"
framework: backgroundassets
role: symbol
role_heading: Instance Method
path: "backgroundassets/assetpackmanager/descriptor(for:searchinginassetpackwithid:)"
---

# descriptor(for:searchingInAssetPackWithID:)

Opens and returns a file descriptor for an asset file at the specified relative path.

## Declaration

```swift
nonisolated func descriptor(for path: FilePath, searchingInAssetPackWithID assetPackID: String? = nil) throws -> FileDescriptor
```

## Parameters

- `path`: The relative path.
- `assetPackID`: The ID of the asset pack in which to search for the file. By default, all downloaded asset packs are searched.

## Mentioned in

Downloading Apple-hosted asset packs

## Return Value

Return Value A descriptor for the opened file.

## Discussion

Discussion important: It’s your responsibility to close the file descriptor when you’re done using it. All asset packs share the same namespace, so you can treat the overall collection of downloaded asset packs as if it were a single root directory that contains all of your subdirectories and asset files, regardless of the specific asset pack in which any particular file resides. If there’s a path collision across multiple asset packs, then it’s undefined from which asset pack the file will be read unless you explicitly limit the search to a particular asset pack by passing a non-nil ID to the assetPackID parameter. note: ManagedBackgroundAssetsError.fileNotFound(at:) when no file is found at path. note: When the path is not relative or when some other error occurs while finding or opening the requested file. note: Use this method if you need low-level access to the file descriptor. If you don’t, then use contents(at:searchingInAssetPackWithID:options:) instead.

## See Also

### Accessing asset contents

- [contents(at:searchingInAssetPackWithID:options:)](backgroundassets/assetpackmanager/contents(at:searchinginassetpackwithid:options:).md)
- [contents(at:asLocalizedFor:options:)](backgroundassets/assetpackmanager/contents(at:aslocalizedfor:options:).md)
- [descriptor(for:asLocalizedFor:)](backgroundassets/assetpackmanager/descriptor(for:aslocalizedfor:).md)
- [url(for:)](backgroundassets/assetpackmanager/url(for:).md)
- [url(for:asLocalizedFor:)](backgroundassets/assetpackmanager/url(for:aslocalizedfor:).md)
