///|
/// Appends a Bytes payload to the file at path for WASM target (fallback to read-merge-write).
pub fn append_bytes_to_file(
path : String,
content : Bytes,
) -> Unit raise MoonKVError {
try {
if @fs.path_exists(path) {
let existing = @fs.read_file_to_bytes(path)
let combined = merge_bytes(existing, content)
@fs.write_bytes_to_file(path, combined)
} else {
@fs.write_bytes_to_file(path, content)
}
} catch {
_ => raise MoonKVError::IOError("Failed to append bytes to file \{path}")
}
}