Skip to content

Function: pickDir()

ts
function pickDir(dirKey: string, force: boolean): Promise<{
  data: FileSystemDirectoryHandle | null;
  message: string;
  success: boolean;
}>

选择文件夹(与saveFileToDir共用缓存)

Example

ts
//选择文件夹,将其与key绑定
pickDir('key');
//强制重新选择
pickDir('key', true);

Parameters

ParameterTypeDefault valueDescription

dirKey

string

undefined

文件夹唯一标识,自行定义string,用于后续向同一文件夹写入文件

force

boolean

false

是否强制重新选择

Returns

Promise<{ data: FileSystemDirectoryHandle | null; message: string; success: boolean; }>

NameType
dataFileSystemDirectoryHandle | null
messagestring
successboolean