What is get-npm-tarball-url?
The npm package 'get-npm-tarball-url' is designed to retrieve the tarball URL of a given npm package. This is useful for various purposes such as downloading the package source code, analyzing package contents, or integrating with build systems that require direct access to npm package tarballs.
What are get-npm-tarball-url's main functionalities?
Retrieve tarball URL
This feature allows users to fetch the tarball URL for a specific version of an npm package. The function 'getTarballUrl' takes a package name and a version, then logs the URL or an error if it fails.
const getNpmTarballUrl = require('get-npm-tarball-url');
async function getTarballUrl(packageName, version) {
try {
const url = await getNpmTarballUrl(packageName, version);
console.log('Tarball URL:', url);
} catch (error) {
console.error('Error fetching tarball URL:', error);
}
}
getTarballUrl('express', '4.17.1');
Other packages similar to get-npm-tarball-url
npm-registry-fetch
This package provides a more comprehensive API for interacting with the npm registry, including fetching tarball URLs. It offers more extensive control over requests such as custom headers or specific registry settings, making it more flexible than 'get-npm-tarball-url' for complex use cases.
pacote
Pacote is a library that abstracts fetching npm package metadata and tarballs. It supports various types of package sources like git, npm, and others. Compared to 'get-npm-tarball-url', Pacote offers a broader feature set for handling package manifests and tarballs, making it suitable for applications needing more than just URL retrieval.
get-npm-tarball-url

Create the tarball URL of a npm package
Installation
pnpm add get-npm-tarball-url
Usage
import getNpmTarballUrl from 'get-npm-tarball-url'
const url = getNpmTarballUrl('foo', '1.0.0')
console.log(url)
Related
License
MIT © Zoltan Kochan