alpm_mtree::utils

Function mtree_buffer_to_string

Source
pub fn mtree_buffer_to_string(buffer: Vec<u8>) -> Result<String, Error>
Expand description

Creates a String from a byte vector which may be gzip compressed.

If buffer contains gzip compressed data, it decompressed before converting it into a String. Detects whether buffer contains gzip compressed data by checking if it is longer than two bytes and whether the first two bytes are the GZIP_MAGIC_NUMBER.

ยงErrors

Returns an error if

  • buffer contains invalid gzip compressed data
  • or buffer can not be converted to String.