1
1
use crate :: { exts:: HyperlinkExt , types} ;
2
- use async_compression:: tokio:: bufread:: GzipDecoder ;
2
+ use async_compression:: tokio:: bufread:: XzDecoder ;
3
3
use futures:: TryStreamExt ;
4
4
use indicatif:: { ProgressBar , ProgressStyle } ;
5
5
use serde:: { de:: Error as DeError , Deserialize , Deserializer } ;
@@ -50,9 +50,7 @@ impl NodeRelease {
50
50
. map_err ( |err| std:: io:: Error :: new ( std:: io:: ErrorKind :: Other , err) ) ;
51
51
52
52
let unpack_temporary_folder = types:: temp:: Folder :: new ( ) ?;
53
- // TODO: Use `XzDecoder` since its the default NodeJS website downloads for Linux.
54
- // It's also smaller than Gzip.
55
- let decompressed = GzipDecoder :: new ( BufReader :: new ( StreamReader :: new ( data_stream) ) ) ;
53
+ let decompressed = XzDecoder :: new ( BufReader :: new ( StreamReader :: new ( data_stream) ) ) ;
56
54
Archive :: new ( decompressed)
57
55
. unpack ( unpack_temporary_folder. path ( ) )
58
56
. await ?;
@@ -72,7 +70,7 @@ impl NodeRelease {
72
70
73
71
pub fn get_download_url ( & self ) -> String {
74
72
format ! (
75
- "{}/v{}/{}.tar.gz " ,
73
+ "{}/v{}/{}.tar.xz " ,
76
74
types:: node:: URLs :: default ( ) . get_distribution_path( ) ,
77
75
self . version,
78
76
self . get_archive_string( )
@@ -96,10 +94,8 @@ impl NodeRelease {
96
94
}
97
95
98
96
pub fn is_supported_by_current_platform ( & self ) -> bool {
99
- // TODO: ???
100
- self . files . iter ( ) . any ( |file| {
101
- file. contains ( & types:: platforms:: Platform :: get_system_platform ( ) . to_string ( ) )
102
- } )
97
+ self . files
98
+ . contains ( & types:: platforms:: Platform :: get_system_platform ( ) . to_string ( ) )
103
99
}
104
100
}
105
101
0 commit comments