mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-15 13:43:39 +01:00
17 lines
495 B
TypeScript
17 lines
495 B
TypeScript
import { readBinaryFile, readTextFile } from '@tauri-apps/api/fs';
|
|
import type { HttpResponse } from './models';
|
|
|
|
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 readBinaryFile(response.bodyPath);
|
|
}
|
|
return null;
|
|
}
|