Skip to main content

build_sparse_writers

Function build_sparse_writers 

Source
pub fn build_sparse_writers(
    name: &str,
    file_to_upload: &str,
    max_download_size: u64,
) -> Result<Vec<SparseFileWriter>, SparseError>
Expand description

Takes the given file_to_upload for the named partition and creates a set of SparseFileWriter slices in memory with the provided max_download_size constraining slice size.

§Arguments

  • name - Name of the partition for the image. Used for logs only.
  • file_to_upload - Path to the file to translate to sparse image format.
  • max_download_size - Maximum size that can be downloaded by the device for each slice.

§Errors

Returns SparseError::MaxDownloadSizeTooSmall if max_download_size is less than or equal to the block size ([BLK_SIZE]), or an I/O error if file_to_upload fails to open or read.