# web.send_file ## Function Send local files directly as HTTP responses, suitable for downloading large files or exporting files, to avoid reading the file content into the BT dynamic response string at once. ## Syntax ```bt web.send_file(path) send_file(path) ``` ## Parameters | Parameters | Type | Required | Default value | Description | | ------ | ------ | ------ | ------ | ------ | | path | String/Fs | Yes | None | The local file path to send. The relative path is resolved based on the current source code file directory, and `@/` is resolved based on the project root. | ## Return value | Type | Description | | ------ | ------ | | Bool | Returns true if set successfully; the file is sent by the web layer at the end of the request. | ## Example ```bt web.header('Cache-Control', 'public, max-age=3600') web.send_file('@/downloads/report.csv') ``` ## Notes - Can only be called in a web request. - This ability will read local files and is subject to `BT_PERMISSION_DENY=fs` / `BT_PERMISSION_ALLOW` permission configuration. - File responses are sent in chunks by the web framework, supporting ETag, Last-Modified, conditional requests and HTTP Range. - After `web.send_file()` is set, this request will not write back the last expression or the dynamic response body generated by `print`. - `Content-Type` is inferred by file extension by default; you can call `web.header('Content-Type', value)` in advance when overwriting is required.