[**Documentation**](../../../../README)

***

[Documentation](../../../../README) / [@zerotal/core](../../README) / [index](../README) / file

# Function: file()

> **file**(`path`, `options?`): `Promise`\<`void`\>

Defined in: [helpers/response.ts:361](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/core/src/helpers/response.ts#L361)

Stream a file from disk as the response. Defaults to `attachment` disposition
(a browser download) with the file's basename; override either via `options`.

## Parameters

### path

`string`

Absolute or working-directory-relative path to the file.

### options?

Optional `filename` (download name) and `disposition`
(`"attachment"` to download, `"inline"` to display in the browser).

#### filename?

`string`

#### disposition?

`"inline"` \| `"attachment"`

## Returns

`Promise`\<`void`\>

## Throws

If no file exists at `path`.

## Example

```ts
await file('storage/invoices/2026-07.pdf');                          // download as "2026-07.pdf"
await file('storage/report.pdf', { filename: 'Q3-Report.pdf' });     // download, renamed
await file('storage/preview.pdf', { disposition: 'inline' });        // view in-browser
```
