Something went wrong. Try again.
Starship Simulator Controls thoriumsim.com
Something went wrong. Try again.
612 B · 19 lines
TypeScript
at develop
1234567891011121314151617181920import { mkdir, rename } from "node:fs/promises";import path from "node:path";
import { thoriumContext } from "@thorium/utils/.server/context";
export async function moveFile(file: Blob | File | string, filePath: string, assetPath: string) { const thoriumPath = thoriumContext.getStore()!.thoriumPath; await mkdir(path.join(thoriumPath, assetPath), { recursive: true, }); const writePath = path.join(thoriumPath, assetPath, filePath);
if (typeof file === "string") { await rename(file, writePath); } else { await Bun.write(Bun.file(writePath), file); } return path.join(assetPath, filePath);}