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

# getPathEncryptionStatus

> 获取文件或目录的加密状态。

```ts wrap theme={null}
static getPathEncryptionStatus(filePath: string): Promise<APIResponse<number>>;
```

**参数**

| 参数         | 类型       | 说明      |
| ---------- | -------- | ------- |
| `filePath` | `string` | 文件或目录路径 |

**返回**

* [`APIResponse<number>`](/zh/api-reference/supernote-plugin/types/api-response)，`result` 取值：
  * `0`：文件未加密
  * `1`：文件已加密，但当前插件会话中尚未解密
  * `2`：文件已加密，且已在当前插件会话中解密

## 示例

```ts wrap theme={null}
import { PluginFileAPI } from 'sn-plugin-lib';

/**
 * 查询文件或目录加密状态的示例。
 */
export async function exampleGetPathEncryptionStatus() {
  const filePath = '/storage/emulated/0/Note/demo.note';

  const res = await PluginFileAPI.getPathEncryptionStatus(filePath);
  if (!res.success) {
    throw new Error(res.error?.message ?? 'getPathEncryptionStatus 调用失败');
  }

  return res.result;
}
```
