How can I download the source code of a package from npm without actually installing it (i.e. without using npm install thepackage
)?
You can use npm view [package name] dist.tarball
which will return the URL of the compressed package file.
Here's an example using wget
to download the tarball:
wget $(npm view lodash dist.tarball)