# ContainerResource.WithContainerFilesCallback

- Module: [Aspire.Hosting](/reference/api/go/aspire.hosting.md)
- Defined on: [ContainerResource](/reference/api/go/aspire.hosting/containerresource.md)
- Version: `17.0.0`
- Kind: `method`

Creates or updates files and/or folders at the destination path in the container using entries produced by a callback.

## Definition

```go
type ContainerResource interface {
    // ... omitted for brevity
    WithContainerFilesCallback(
        destinationPath string,
        callback func(arg1 ContainerFileSystemCallbackContext, arg2 *CancellationToken) []ContainerFileSystemItem,
        options ...*ContainerFilesOptions,
    ) ContainerResource
}
```

## Signature

```go
WithContainerFilesCallback(
    destinationPath string,
    callback func(arg1 ContainerFileSystemCallbackContext, arg2 *CancellationToken) []ContainerFileSystemItem,
    options ...*ContainerFilesOptions,
) ContainerResource
```

## Parameters

- `destinationPath` (`string`) -- The destination absolute path in the container.
- `callback` (`func(arg1 ContainerFileSystemCallbackContext, arg2 *CancellationToken) []ContainerFileSystemItem`) -- A callback that returns the file system entries to create or update. Use the factory methods on `ContainerFileSystemCallbackContext` (createFile, createDirectory, createCertificateFile) to build the entries.
- `options` (`...*ContainerFilesOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed as the existing [`*ContainerFilesOptions`](/reference/api/go/aspire.hosting/containerfilesoptions.md) struct.

## Returns

[`ContainerResource`](/reference/api/go/aspire.hosting/containerresource.md) -- The resource builder.

Returns a handle; failures surface later via `Err()`.

## Defined on

- [ContainerResource](/reference/api/go/aspire.hosting/containerresource.md) -- `handle`
