generated from Labyricorn/labyricorn-project-template
Initial commit (forked from jamiepine/voicebox)
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import type { FileFilter, PlatformFilesystem } from '@/platform/types';
|
||||
|
||||
export const webFilesystem: PlatformFilesystem = {
|
||||
async saveFile(filename: string, blob: Blob, _filters?: FileFilter[]) {
|
||||
// Browser: trigger download
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
document.body.removeChild(a);
|
||||
},
|
||||
|
||||
async openPath(_path: string) {
|
||||
// No filesystem access in browser
|
||||
},
|
||||
|
||||
async pickDirectory(_title: string) {
|
||||
return null;
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user