Skip to main content

Function: saveFile()

saveFile(blob, name, picker?, fileType?): Promise<SaveMethod | undefined>

Defined in: src/lib/rendering/screenshot/index.ts:137

Save a file. Where the browser supports it, a save dialog lets the user choose the folder; otherwise it downloads. Returns how it was saved, or undefined if the user cancelled the dialog.

Parameters​

blob​

Blob

name​

string

picker?​

SaveFilePicker | undefined = ...

window.showSaveFilePicker (replaceable for tests)

fileType?​

SaveFileType = PNG_FILE_TYPE

the kind of file the save dialog offers (PNG by default)

Returns​

Promise<SaveMethod | undefined>