Browse Source

fix: remove test file

20230320
Emmm Monster 4 years ago
parent
commit
3645dd7d01
No known key found for this signature in database GPG Key ID: C98279C83FB50DB9
  1. 9
      src/shims-fs.d.ts
  2. 6
      src/view/Home.vue

9
src/shims-fs.d.ts

@ -6,6 +6,10 @@ interface FileSystemCreateWritableOptions {
keepExistingData?: boolean
}
interface FileSystemRemoveOptions {
recursive?: boolean
}
interface FileSystemFileHandle {
getFile(): Promise<File>;
@ -37,13 +41,16 @@ interface FileSystemWritableFileStream extends WritableStream {
close(): Promise<undefined> // should be implemented in WritableStream
}
export declare interface FileSystemDirectoryHandle {
getFileHandle(name: string, options?: FileSystemGetFileOptions): Promise<FileSystemFileHandle>
removeEntry(name: string, options?: FileSystemRemoveOptions): Promise<undefined>
}
declare global {
interface Window {
FileSystemDirectoryHandle
showDirectoryPicker?(): Promise<FileSystemDirectoryHandle>
}

6
src/view/Home.vue

@ -144,9 +144,9 @@ export default {
}
try {
this.dir = await window.showDirectoryPicker()
window.dir = this.dir
window.f = await this.dir.getFileHandle("write-test.txt", {create: true})
const test_filename = "__unlock_music_write_test.txt"
await this.dir.getFileHandle(test_filename, {create: true})
await this.dir.removeEntry(test_filename)
} catch (e) {
console.error(e)
}

Loading…
Cancel
Save