Skip to content

Commit f6a4a76

Browse files
committed
fix: 添加 File System Access API 类型声明
1 parent ae55cfa commit f6a4a76

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
interface FileSystemFileHandle {
2+
getFile(): Promise<File>
3+
createWritable(): Promise<FileSystemWritableFileStream>
4+
}
5+
6+
interface FileSystemDirectoryHandle {
7+
getDirectoryHandle(name: string, options?: { create?: boolean }): Promise<FileSystemDirectoryHandle>
8+
getFileHandle(name: string, options?: { create?: boolean }): Promise<FileSystemFileHandle>
9+
values(): AsyncIterableIterator<FileSystemDirectoryHandle | FileSystemFileHandle>
10+
readonly kind: 'directory'
11+
readonly name: string
12+
}
13+
14+
interface FileSystemWritableFileStream extends WritableStream {
15+
write(data: BufferSource | Blob | string): Promise<void>
16+
close(): Promise<void>
17+
}
18+
19+
interface ShowOpenFilePickerOptions {
20+
id?: string
21+
startIn?: string
22+
types?: { description?: string; accept: Record<string, string[]> }[]
23+
multiple?: boolean
24+
}
25+
26+
interface ShowDirectoryPickerOptions {
27+
id?: string
28+
startIn?: string
29+
mode?: 'read' | 'readwrite'
30+
}
31+
32+
interface Window {
33+
showOpenFilePicker(options?: ShowOpenFilePickerOptions): Promise<FileSystemFileHandle[]>
34+
showDirectoryPicker(options?: ShowDirectoryPickerOptions): Promise<FileSystemDirectoryHandle>
35+
}

0 commit comments

Comments
 (0)