> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squarecloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# 读取文件

> 从你的应用程序中读取一个文件。

<ParamField header="Authorization" type="string" placeholder="API Key" required>
  你账户的 API 密钥。你可以在[账户设置](https://squarecloud.app/zh/account/security)中找到它。
</ParamField>

### 参数

<ParamField path="app_id" type="string" placeholder="Application ID" required>
  应用程序的 ID。你可以在应用程序仪表盘的 URL 中找到它。
</ParamField>

<ParamField query="path" type="string" placeholder="Example: src/index.js" required>
  你想读取的文件路径。该路径相对于应用程序的根目录。
</ParamField>

### 响应

<ResponseField name="status" type="string">
  指示调用是否成功。成功时为 `success`，否则为 `error`。
</ResponseField>

<ResponseField name="response" type="object">
  文件的内容。

  <Expandable title="展开对象">
    <ResponseField name="type" type="string">
      数据的类型。对于二进制数据，其值为 "Buffer"。
    </ResponseField>

    <ResponseField name="data" type="array">
      以数字数组形式表示的文件数据。这些数字代表文件的字节。
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json theme={null}
  {
      "status": "success",
      "response": {
          "type": "Buffer",
          "data": [
              112,
              111,
              120,
              97,
              44,
              32,
              116,
              97,
              32,
              113,
              117,
              101,
              114,
              101,
              110,
              100,
              111,
              32,
              99,
              111,
              112,
              105,
              97,
              114,
              32,
              97,
              116,
              195,
              169,
              32,
              111,
              32,
              98,
              117,
              102,
              102,
              101,
              114,
              63
          ]
      }
  }
  ```
</ResponseExample>
