cabinet: Add helper functions for temp file manipulations.