Skip to content

Instantly share code, notes, and snippets.

@dogancelik
Last active April 6, 2023 02:41
Show Gist options
  • Save dogancelik/8af8c54fb89091156b2bf7ed36319ec0 to your computer and use it in GitHub Desktop.
Save dogancelik/8af8c54fb89091156b2bf7ed36319ec0 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