7 lines
413 B
TypeScript
7 lines
413 B
TypeScript
const dir = new URL("../fixtures/", import.meta.url);
|
|
|
|
export const fixtureText = (path: string): Promise<string> => Bun.file(new URL(path, dir)).text();
|
|
export const fixtureBytes = async (path: string): Promise<Uint8Array> =>
|
|
new Uint8Array(await Bun.file(new URL(path, dir)).arrayBuffer());
|
|
export const fixtureJson = async <T = unknown>(path: string): Promise<T> => JSON.parse(await fixtureText(path)) as T;
|