feat: desktop app

Co-authored-by: Vivek R <123vivekr@gmail.com>
Co-authored-by: Liyas Thomas <liyascthomas@gmail.com>
This commit is contained in:
Andrew Bastin
2023-11-07 14:01:00 +05:30
parent 4ebf850cb6
commit 16044b5840
134 changed files with 11814 additions and 206 deletions

View File

@@ -0,0 +1,24 @@
import { IOPlatformDef } from "@hoppscotch/common/platform/io"
import { save } from "@tauri-apps/api/dialog"
import { writeBinaryFile, writeTextFile } from "@tauri-apps/api/fs"
export const ioDef: IOPlatformDef = {
async saveFileWithDialog(opts) {
const path = await save({
filters: opts.filters,
defaultPath: opts.suggestedFilename,
})
if (path === null) {
return { type: "cancelled" }
}
if (typeof opts.data === "string") {
await writeTextFile(path, opts.data)
} else {
await writeBinaryFile(path, opts.data)
}
return { type: "saved", path }
},
}