# ValkeyResource.withDataVolume

- Module: [Aspire.Hosting.Valkey](/reference/api/typescript/aspire.hosting.valkey.md)
- Defined on: [ValkeyResource](/reference/api/typescript/aspire.hosting.valkey/valkeyresource.md)
- Version: `13.4.0`
- Kind: `method`

Adds a named volume for the data folder to a Valkey container resource and enables Valkey persistence.

## Definition

```typescript
interface ValkeyResource {
  // ... omitted for brevity
  withDataVolume(
      name?: string,
      isReadOnly?: boolean): ValkeyResource;
}
```

## Signature

```typescript
withDataVolume(
    name?: string,
    isReadOnly?: boolean): ValkeyResource
```

## Parameters

- `name` (`string`) `optional`
- `isReadOnly` (`boolean`) `optional` `= False`

## Returns

[ValkeyResource](/reference/api/typescript/aspire.hosting.valkey/valkeyresource.md) `builder`

## Defined on

- [ValkeyResource](/reference/api/typescript/aspire.hosting.valkey/valkeyresource.md) -- `handle`
