diff options
author | boasting-squirrel <boasting.squirrel@gmail.com> | 2019-03-15 16:50:59 +0000 |
---|---|---|
committer | boasting-squirrel <boasting.squirrel@gmail.com> | 2019-03-15 16:50:59 +0000 |
commit | bc293fa54a612ff7e2d6088ba5d91890cad75b81 (patch) | |
tree | d228c1a05877449bd7ac157d7e9dbed2b8f3345e /src/archive.rs | |
parent | Improved design (diff) | |
download | miniserve-bc293fa54a612ff7e2d6088ba5d91890cad75b81.tar.gz miniserve-bc293fa54a612ff7e2d6088ba5d91890cad75b81.zip |
Renamed create_archive_file function and added documentation
Diffstat (limited to 'src/archive.rs')
-rw-r--r-- | src/archive.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/archive.rs b/src/archive.rs index c536c2d..bc8ea3b 100644 --- a/src/archive.rs +++ b/src/archive.rs @@ -46,7 +46,9 @@ impl CompressionMethod { } } -pub fn create_archive_file( +/// Creates an archive of a folder, using the algorithm the user chose from the web interface +/// This method returns the archive as a stream of bytes +pub fn create_archive( method: &CompressionMethod, dir: &PathBuf, skip_symlinks: bool, @@ -56,7 +58,7 @@ pub fn create_archive_file( } } -/// Compresses a given folder in .tar.gz format +/// Compresses a given folder in .tar.gz format, and returns the result as a stream of bytes fn tgz_compress( dir: &PathBuf, skip_symlinks: bool, @@ -90,7 +92,7 @@ fn tgz_compress( Ok((dst_tgz_filename, data)) } -/// Creates a temporary tar file of a given directory, reads it and returns its content as bytes +/// Creates a TAR archive of a folder, and returns it as a stream of bytes fn tar( src_dir: String, inner_folder: String, @@ -119,7 +121,7 @@ fn tar( Ok(tar_content) } -/// Compresses a stream of bytes using the GZIP algorithm +/// Compresses a stream of bytes using the GZIP algorithm, and returns the resulting stream fn gzip(mut data: &[u8]) -> Result<Vec<u8>, errors::CompressionError> { let mut encoder = Encoder::new(Vec::new()).context(errors::CompressionErrorKind::GZipBuildingError { |