mirror of
https://github.com/lifegpc/garbro-rs.git
synced 2026-06-20 02:44:34 +08:00
Basic Picture Preview Impl
This commit is contained in:
19
src/api.ts
Normal file
19
src/api.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { GameTitle, Entry, FileOptions } from "./types";
|
||||
|
||||
export async function getStartDirectory(): Promise<string> {
|
||||
return await invoke("get_start_directory");
|
||||
}
|
||||
|
||||
export async function getXp3SupportedGames(): Promise<GameTitle[]> {
|
||||
return await invoke("get_xp3_supported_games");
|
||||
}
|
||||
|
||||
export async function listDirectory(path: string, options?: FileOptions[]): Promise<Entry[]> {
|
||||
return await invoke("list_directory", { path, options: options ?? null });
|
||||
}
|
||||
|
||||
export async function previewImage(path: string, options?: FileOptions[]): Promise<Uint8Array> {
|
||||
const bytes: number[] = await invoke("preview_image", { path, options: options ?? null });
|
||||
return new Uint8Array(bytes);
|
||||
}
|
||||
Reference in New Issue
Block a user