ic-backup 0.55.2

Host-side snapshot backup and same-release recovery for Internet Computer canisters
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! Exact native fixture byte retention; callers own parent sync and suspension timing.

use std::{
    fs::File,
    io::{self, Write},
    path::Path,
};

// Preserve create/truncate policy and permissions; callers retain the synced descriptor
// for the original qualification lifetime.
pub(crate) fn write_synced(path: &Path, bytes: &[u8]) -> io::Result<File> {
    let mut file = File::create(path)?;
    file.write_all(bytes)?;
    file.sync_all()?;
    Ok(file)
}