karenina.utils.file_ops¶
file_ops
¶
File operation utilities for Karenina.
Provides reusable atomic file write functionality.
Functions¶
atomic_write
¶
Write content to file atomically using write-rename pattern.
Writes data to a temporary partial file, then atomically renames it to the target path. This ensures the file is never in a partially written state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Path
|
Target file path |
required |
|
str
|
Content to write |
required |
Raises:
| Type | Description |
|---|---|
OSError
|
If the write or rename fails |