# withDataVolume

- Module: [Aspire.Hosting.PostgreSQL](/reference/api/typescript/aspire.hosting.postgresql.md)
- Version: `13.4.0`
- Kind: `method`
- Source: [GitHub](https://github.com/microsoft/aspire)

Adds a named volume for the data folder to a PostgreSQL container resource.

## Definition

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

## Parameters

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

## Returns

[PostgresServerResource](/reference/api/typescript/aspire.hosting.postgresql/postgresserverresource.md) `builder`

## Applies to

- [PostgresServerResource](/reference/api/typescript/aspire.hosting.postgresql/postgresserverresource.md)
