static unlockPathWithPassword(filePath: string, password: string): Promise<APIResponse<boolean>>;
| 参数 | 类型 | 说明 |
|---|---|---|
filePath | string | 文件或目录路径 |
password | string | 用于解锁该路径的密码 |
APIResponse<boolean>:result === true表示解锁成功,result === false表示解锁失败
示例
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;
}