trimHistoryFile(file: string,history: readonly string[]): void
Cuts the history file back to the history it is meant to hold.
Only ever SHORTENS. Growing a file with truncate pads it with zero bytes, and a history file
full of NULs is a worse problem than the one this solves — so a file that is already the right
size, or somehow shorter, is left exactly as it is.
Best-effort throughout: a history file is a convenience, and no failure to tidy one is worth interrupting a session over.
import { trimHistoryFile } from './history.ts'; trimHistoryFile('/nonexistent/history', ['a']); // does nothing, says nothing