a package has one metadata document, a JSON "packument"
a packument lists all of the versions of the package and the times they were published
a version has a tarball
- /${pkg urlencoded} for packuments
- /${pkg}/-/${name}-${version}.tgz for tarballs
e.g.:
- /lodash and /lodash/-/lodash-4.17.11.tgz, or
- /%40slack%2fclient and /﹫slack/client/-/client-4.8.0.tgz
(forgive the @-homoglyph there)
if there's a version in "time" but not in "versions", it's been unpublished
"dist-tags" contains tag names, and is required to have "latest"
GET /<pkg>
<figure out which version you wanted>
GET /<pkg>/-/<pkg>-<version>.tgz
(repeated for all <pkg>'s in the tree you want to install)
- send an accept header of "application/vnd.npm.install-v1+json" to get a shorter (or "corgi") packument (your CLI does this for you)
- to authorize a request, send "authorization: Bearer <your token>" (you can use basic auth too but please, please don't.)
- each package-version contains a dist stanza with an SRI hash, unpacked size, file count, and npm signature
GET /lodash/-/lodash-4.17.11.index (replacing "tgz" with "index")
(💞 to @soldair for this)