TempfileCreator
Pure functional module for creating temporary files with standardized error handling. This module eliminates code duplication between Crtemp class and FunctionalCrtemp.
Class methods
create(crtemp_path : String, prefix : String, data : Slice(UInt8) | Nil = nil) : CrtempResult::Result(String, Crtemp::Error)
Create a temporary file with secure permissions using mkstemp if available, falling back to atomic file creation if mkstemp is unavailable.
Arguments:
crtemp_path: Path to the temporary directory where the file will be createdprefix: Prefix for the temporary filename (max 100 characters)data: Optional data to write to the file immediately
Returns:
- Success with file path on successful creation
- Failure with TempfileError or WriteError on failure