使用 PowerShell 5.1,如何下载tar.xz存档并解压而不先将其写入磁盘?
所有这些尝试:
Invoke-WebRequest https://www.examle.com/archive.tar.xz -UseBasicParsing | 7z x -si
(Invoke-WebRequest https://www.examle.com/archive.tar.xz -UseBasicParsing).ToString() | 7z x -si
(Invoke-WebRequest https://www.examle.com/archive.tar.xz -UseBasicParsing).Content | 7z x -si
(Invoke-WebRequest https://www.examle.com/archive.tar.xz -UseBasicParsing).RawContent | 7z x -si
Run Code Online (Sandbox Code Playgroud)
给出这个错误:
7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21
Extracting archive:
ERROR:
Can not open encrypted archive. Wrong password?
Not implemented
Can't open as archive: 1
Files: 0
Size: 0
Compressed: 0
Run Code Online (Sandbox Code Playgroud)
这有效:
Invoke-WebRequest https://www.examle.com/archive.tar.xz -UseBasicParsing -OutFile temp.tar.xz
7z x temp.tar.xz
Run Code Online (Sandbox Code Playgroud)