> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XPackageFindChunkAvailability

> XPackageFindChunkAvailability

# XPackageFindChunkAvailability

Returns the minimum availability for the collection of chunks that match the specified selectors.

## Syntax

```cpp theme={null}
HRESULT XPackageFindChunkAvailability(  
         const char* packageIdentifier,  
         uint32_t selectorCount,  
         XPackageChunkSelector* selectors,  
         XPackageChunkAvailability* availability  
)  
```

### Parameters

*packageIdentifier*   \_In\_z\_\
Type: char\*

A string that uniquely identifies the installed package on the disk. For more information about package identifiers, see [Manage and license downloadable content (DLC)](/publishing/xstore-commerce/xstore-dlc).

*selectorCount*   \_In\_\
Type: uint32\_t

The number of selectors in the *selectors* parameter.

*selectors*   \_In\_reads\_opt\_(selectorCount)\
Type: [XPackageChunkSelector\*](/reference/system/xpackage/structs/xpackagechunkselector)

An array of selectors that specify the chunks to be checked.

*availability*   \_Out\_\
Type: [XPackageChunkAvailability\*](/reference/system/xpackage/enums/xpackagechunkavailability)

On return, lists the availability of the chunks.

### Return value

Type: HRESULT

HRESULT success or error code.

## Remarks

<Note>This function isn't safe to call on a time-sensitive thread. For more information, see [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).</Note>

**XPackageFindChunkAvailability** takes an array of chunk selectors, finds the associated chunks, and then returns the minimum availability for those chunks. Availability ranges according to the following values:

* Ready: The chunk is already installed and can be read.
* Pending: The chunk is not installed yet but will be.
* Installable: The chunk will not be installed, but it could be downloaded.
* Unavailable: The chunk cannot be downloaded.

The following example accepts a track name for a racing game and, if the track is not installed, prints the download size for the track:

```cpp theme={null}
HRESULT ListDownloadSize(char* trackName)
{
    XPackageChunkSelector selector;
    selector.type = XPackageChunkSelectorType::Tag;
    selector.tag = trackName;

    char id[XPACKAGE_IDENTIFIER_MAX_LENGTH];
    HRESULT hr = XPackageGetCurrentProcessPackageIdentifier(_countof(id), id);
    if (FAILED(hr)) return hr;

    XPackageChunkAvailability availability;
    hr = XPackageFindChunkAvailability(id, 1, &selector, &availability);
    if (FAILED(hr)) return hr;

    if (availability == XPackageChunkAvailability::Installable)
    {
        uint64_t downloadSize;
        hr = XPackageEstimateDownloadSize(id, 1, &selector, &downloadSize, nullptr);
        if (FAILED(hr)) return hr;

        printf("Download Size for track %s: %I64u\n", trackName, downloadSize);
    }

    return hr;
}
```

## Requirements

**Header:** XPackage.h

**Library:** xgameruntime.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## Conceptual documentation

* [Intelligent Delivery: custom tag specifiers](/build/core-features/common/packaging/intelligentdelivery-custom)
* [Intelligent Delivery: features and recipes](/build/core-features/common/packaging/intelligentdelivery-features-recipes)
* [Intelligent Delivery: language specifiers](/build/core-features/common/packaging/intelligentdelivery-language)
* [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## See also

[XPackage](/reference/system/xpackage/xpackage_members)\
[Streaming Installation and Intelligent Delivery](/build/core-features/common/packaging/overviews/streaming_install-intelligent_delivery)


## Related topics

- [Intelligent Delivery: custom tag specifiers](/build/core-features/common/packaging/intelligentdelivery-custom.md)
- [Intelligent Delivery: features and recipes](/build/core-features/common/packaging/intelligentdelivery-features-recipes.md)
- [XPackage](/reference/system/xpackage/xpackage_members.md)
- [Unity C# API wrappers for the GDK](/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XPackageChunkAvailability](/reference/system/xpackage/enums/xpackagechunkavailability.md)
