> ## 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.

# unlockPathWithPassword

> 使用密码解锁已加密的文件或目录。

```ts wrap theme={null}
static unlockPathWithPassword(filePath: string, password: string): Promise<APIResponse<boolean>>;
```

**参数**

| 参数         | 类型       | 说明         |
| ---------- | -------- | ---------- |
| `filePath` | `string` | 文件或目录路径    |
| `password` | `string` | 用于解锁该路径的密码 |

**返回**

* [`APIResponse<boolean>`](/zh/api-reference/supernote-plugin/types/api-response)：
  `result === true` 表示解锁成功，`result === false` 表示解锁失败

## 示例

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

/**
 * 使用密码解锁加密路径的示例。
 */
export async function exampleUnlockPathWithPassword() {
  const filePath = '/storage/emulated/0/Note/demo.note';
  const password = '123456';

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

  return res.result;
}
```
