# IRPCClientScript.DownloadScriptApplicationFile_ReadBlock

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Vault API](https://developer.m-files.com/APIs/gRPC-API/vault/index.md) > [Client scripts and UI extension applications](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCClientScript/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCClientScript/DownloadScriptApplicationFile_ReadBlock/

Badges: `Vault API / standard` `read` `session` `idempotent`

Reads the next block of an application download.

- **Service:** [Client scripts and UI extension applications](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCClientScript/index.md) `MFiles.IRPCClientScript`
- **gRPC method:** `/MFiles.IRPCClientScript/DownloadScriptApplicationFile_ReadBlock`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/download-script-application-file_-read-block`
- **Request:** [`DownloadScriptApplicationFile_ReadBlockRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCClientScript/DownloadScriptApplicationFile_ReadBlock/index.md#request)
- **Response:** [`DownloadScriptApplicationFile_ReadBlockResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCClientScript/DownloadScriptApplicationFile_ReadBlock/index.md#response)
- **Book and level:** Vault API, standard
- **Kind:** read
- **Session:** Required: the session ID from LogIn in the mfiles-session-id-bin metadata.
- **Idempotent:** yes
- **Returns metadata structure version:** no
- **Streaming:** none (unary)

<a id="remarks"></a>

## Remarks

- Read the blocks in order. The download is removed after the read that reaches the end of the
  file; later reads fail with "Not found. (The specified download session ... does not exist.)".
- Also reads downloads started with
  [GetDownloadSessionIdOfScriptApplicationFile](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCClientScript/GetDownloadSessionIdOfScriptApplicationFile/index.md).

<a id="request"></a>

## Request: DownloadScriptApplicationFile_ReadBlockRequest

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `download_id` | `int32` | The ID of the download. |
| `block_size` | `uint32` | The number of bytes to read, at most 4 MiB. |
| `offset` | `int64` | The byte offset to read from. |

<a id="response"></a>

## Response: DownloadScriptApplicationFile_ReadBlockResponse

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `data` | `bytes` | The bytes read; shorter than `block_size` at the end of the file. |

<a id="related"></a>

## Related methods

- [GetDownloadSessionIdOfScriptApplicationFile](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCClientScript/GetDownloadSessionIdOfScriptApplicationFile/index.md): Starts downloading one file of a UI extension application of the new M-Files clients.
- [DownloadScriptApplicationFile_Begin](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCClientScript/DownloadScriptApplicationFile_Begin/index.md): Starts downloading the package (ZIP file) of an application and returns its first block.
- [DownloadScriptApplication](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCClientScript/DownloadScriptApplication/index.md): Not implemented: fails with "Not implemented.".
