Files
yaak-mountain-loop/src-web/lib/responseBody.ts
Gregory Schier f967820f12 Model and DB refactor (#61)
- [x] Move from `sqlx` to `rusqlite`
- [x] Generate TS types from Rust models
2024-08-05 07:58:20 -07:00

17 lines
490 B
TypeScript

import { readFile, readTextFile } from '@tauri-apps/plugin-fs';
import type { HttpResponse } from '@yaakapp/api';
export async function getResponseBodyText(response: HttpResponse): Promise<string | null> {
if (response.bodyPath) {
return await readTextFile(response.bodyPath);
}
return null;
}
export async function getResponseBodyBlob(response: HttpResponse): Promise<Uint8Array | null> {
if (response.bodyPath) {
return readFile(response.bodyPath);
}
return null;
}