Skip to content

Instantly share code, notes, and snippets.

@DerekNonGeneric
Forked from dogancelik/README.md
Created October 15, 2022 07:20
Show Gist options
  • Save DerekNonGeneric/d21ba6079563ef408da278ed7ff72aea to your computer and use it in GitHub Desktop.
Save DerekNonGeneric/d21ba6079563ef408da278ed7ff72aea to your computer and use it in GitHub Desktop.
Download all tarballs of an NPM package #npm

Download all tarballs of an NPM package

I will list the methods you can download npm tarballs.

curl + jq + wget

curl -s https://registry.npmjs.org/del | jq -r .versions[].dist.tarball | wget -i -

nushell + wget

fetch "https://registry.npmjs.org/del" | get versions | pivot | each { get Column1.dist.tarball } | str collect $(char newline) | wget -i -

curl + grep + cut + wget

curl -s https://registry.npmjs.org/del | grep -Po '"tarball":"https.*?\.tgz"' | cut -d '"' -f 4 | wget -i -

PowerShell (pwsh)

$(Invoke-WebRequest "https://registry.npmjs.org/del" | ConvertFrom-Json).versions.PSObject.Properties.Value.dist.tarball | foreach { Invoke-WebRequest -Uri $_ -OutFile $(Split-Path -Path $_ -Leaf) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment