Skip to content

Commit c2a33e5

Browse files
authored
Update request.rs
1 parent 8f0bf47 commit c2a33e5

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

crates/vite_package_manager/src/request.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,16 @@ pub async fn download_and_extract_tgz_with_hash(
185185
Ok(())
186186
}
187187

188+
/// Computes the hash of the given content using the specified digest algorithm.
189+
///
190+
/// # Type Parameters
191+
/// * `D` - A type that implements the [`Digest`](sha2::Digest) trait, such as `Sha256`, `Sha512`, etc.
192+
///
193+
/// # Arguments
194+
/// * `content` - The byte slice to hash.
195+
///
196+
/// # Returns
197+
/// A hex-encoded string representing the computed digest.
188198
fn compute_hash<D: Digest>(content: &[u8]) -> String {
189199
let mut hasher = D::new();
190200
hasher.update(content);

0 commit comments

Comments
 (0)