discardScratch

tcmts.studio.discardScratch · #fkb4gqmc · term · runs on the server

uses node:fs

Throw the scratch file file away, unsaved work and all.

import { editableCodebase, scratchPath, setKeptInto } from "#codebase/tcmts/studio";
import fs from "node:fs";

export async function discardScratch(file: string): Promise<void> {
  const cb = editableCodebase();
  const abs = scratchPath(cb, file);
  fs.rmSync(abs, { force: true });
  setKeptInto(cb, abs, undefined);
}

uses

used by