chore: fix issue with downloading multiple files on macOS

This commit is contained in:
Aman Harwara
2024-01-03 22:56:01 +05:30
parent bc0f444ed8
commit 64351dd304
8 changed files with 52 additions and 20 deletions

View File

@@ -29,7 +29,7 @@
"@standardnotes/common": "^1.50.0",
"@standardnotes/files": "workspace:*",
"@standardnotes/utils": "workspace:*",
"@types/wicg-file-system-access": "^2020.9.5",
"@types/wicg-file-system-access": "^2023.10.4",
"reflect-metadata": "^0.1.13"
}
}

View File

@@ -22,12 +22,14 @@ export class StreamingFileSaver {
}
/** This function must be called in response to a user interaction, otherwise, it will be rejected by the browser. */
async selectFileToSaveTo(): Promise<void> {
async selectFileToSaveTo(handle?: FileSystemFileHandle): Promise<void> {
this.log('Showing save file picker')
const downloadHandle = await window.showSaveFilePicker({
suggestedName: this.name,
})
const downloadHandle = handle
? handle
: await window.showSaveFilePicker({
suggestedName: this.name,
})
this.writableStream = await downloadHandle.createWritable()
}