@@ -769,30 +769,6 @@ pub fn untar_zst_file<R: std::io::Read>(
769769 Ok ( files)
770770}
771771
772- /// Unpack a `.tar.xz` archive into the target directory, without requiring `Seek`.
773- ///
774- /// This is useful for unpacking files as they're being downloaded.
775- ///
776- /// Returns the list of unpacked files and their sizes.
777- pub async fn untar_xz < R : tokio:: io:: AsyncRead + Unpin > (
778- reader : R ,
779- target : impl AsRef < Path > ,
780- ) -> Result < Vec < ( PathBuf , u64 ) > , Error > {
781- let reader = tokio:: io:: BufReader :: with_capacity ( DEFAULT_BUF_SIZE , reader) ;
782- let mut decompressed_bytes = async_compression:: tokio:: bufread:: XzDecoder :: new ( reader) ;
783-
784- let archive = tokio_tar:: ArchiveBuilder :: new (
785- & mut decompressed_bytes as & mut ( dyn tokio:: io:: AsyncRead + Unpin ) ,
786- )
787- . set_preserve_mtime ( false )
788- . set_preserve_permissions ( false )
789- . set_allow_external_symlinks ( false )
790- . build ( ) ;
791- untar_in ( archive, target. as_ref ( ) )
792- . await
793- . map_err ( Error :: io_or_compression)
794- }
795-
796772/// Unpack a `.tar` archive into the target directory, without requiring `Seek`.
797773///
798774/// This is useful for unpacking files as they're being downloaded.
@@ -815,7 +791,7 @@ pub async fn untar<R: tokio::io::AsyncRead + Unpin>(
815791 . map_err ( Error :: io_or_compression)
816792}
817793
818- /// Unpack a `.zip`, `.tar.gz`, `.tar.bz2`, `.tar.zst`, or `.tar.xz ` archive into the target directory,
794+ /// Unpack a `.zip`, `.tar.gz`, `.tar.bz2`, or `.tar.zst ` archive into the target directory,
819795/// without requiring `Seek`.
820796///
821797/// Returns the list of unpacked files and their sizes.
@@ -829,11 +805,7 @@ pub async fn archive<R: tokio::io::AsyncRead + Unpin>(
829805 SourceDistExtension :: Tar => untar ( reader, target) . await ,
830806 SourceDistExtension :: Tgz | SourceDistExtension :: TarGz => untar_gz ( reader, target) . await ,
831807 SourceDistExtension :: Tbz | SourceDistExtension :: TarBz2 => untar_bz2 ( reader, target) . await ,
832- SourceDistExtension :: Txz
833- | SourceDistExtension :: TarXz
834- | SourceDistExtension :: Tlz
835- | SourceDistExtension :: TarLz
836- | SourceDistExtension :: TarLzma => untar_xz ( reader, target) . await ,
837808 SourceDistExtension :: TarZst => untar_zst ( reader, target) . await ,
809+ _ => Err ( Error :: UnsupportedCompression ) ,
838810 }
839811}
0 commit comments