Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Download a package from npm as a tar (not installing it to a module)

Tags:

npm

Is there some URL from which I can download a given package from npm (as a tarball or something)? I need the exact files that were originally uploaded to npm.

Using npm install gets a different, generated package.json for example. I want the exact original set of files that was published.

like image 479
callum Avatar asked Nov 04 '15 20:11

callum


People also ask

How do I download npm without installing?

If you haven't installed npm, with the current public API, you can also access the information about a package in the npm registry from the URL https://registry.npmjs.org/<package-name>/ . Then you can navigate the JSON at versions > (version number) > dist > tarball to get the URL of the code archive and download it.

How do I download tarball from npm?

Use the npm CLI to directly inspect registry information using the npm view command and download the compressed tarball of an NPM package using the [ npm pack <packagename>@<version> ] command.


1 Answers

You can use npm view to get the URL to the registry's tarball (in this example for the module level):

$ npm view level dist.tarball 

And to download tarball, you can use npm pack:

$ npm pack level 
like image 51
Kenan Avatar answered Sep 22 '22 14:09

Kenan