Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Expand-Archive to support Uri ,tarballs and strip #149

Open
mikeTWC1984 opened this issue Aug 21, 2019 · 3 comments
Open

Comments

@mikeTWC1984
Copy link

Summary

I'd think Expand-Archive is one of the heavily used cmdlets in various installation scripts. But currently you still need to do a lot of unnecessary things like:

  • save temp archive file
  • remove temp archive
  • [in some cases] move files from the root catalog to some other folder
  • Also, it doesn't work with tarballs (big deal for linux)

I think we should make Expand-Archive to pull archive directly from url avoiding writing/removing stuff on your disc. I guess that is not that hard to build some custom cmdlet, but I believe this should come out of the box, so installation script can rely on it.

Example:

I need nodejs binaries in my project. I want to put this in "node" subfolder (but not in something like node-v10.16.3-linux-x64 ). In bash this could be achived this way:

mkdir ./node
wget -qO- https://nodejs.org/dist/v10.16.3/node-v10.16.3-linux-x64.tar.xz | tar --transform 's/^dbt2-0.37.50.3/dbt2/' -xvz -C ./node --strip=1

Desired powershell functionality:

$url = https://nodejs.org/dist/v10.16.3/node-v10.16.3-linux-x64.tar.gz
Expand-Archive -Uri $url -type targz -Destination ./node -Strip -Force -Verbose

I think many other core cmdlets with -Path parameter would benefit from such thing too. Maybe we can make Path to understand paths with http:// prefix.

@am11
Copy link

am11 commented Sep 30, 2019

Maybe if Expand-Archive support pipeline, we can get the desired result: "extract archive without first saving to filesystem". Inspired by Unix-y tools:

URL=https://github.com/dotnet/docs/archive/master.tar.gz

# wget
wget -qO- $URL | tar -xvz > /dev/null

# curl
curl -sSL $URL | tar -xvz > /dev/null

it would be great if we could do something like:

(Invoke-WebRequest $URL).Content | Expand-Archive -DestinationPath docs-master

or better yet, streaming:

Invoke-WebRequest -EmitContentToStdOut $URL| Expand-Archive -DestinationPath docs-master

@michael-hawker
Copy link

It'd also be great to tell it to ignore the file extension check too. Sometimes I have a file that's a zip file, but not actually labeled ".zip" so I have to rename it first before sending it to Expand-Archive.

@ThomasNieto
Copy link

@StevenBucher98 can we move this issue to the PowerShell/Microsoft.PowerShell.Archive repository?

@SteveL-MSFT SteveL-MSFT transferred this issue from PowerShell/PowerShell Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants