Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
The npm-name package is used to check the availability of package names on the npm registry. It helps developers to determine if a particular package name is already taken or if it is available for use.
Check single package name
This feature allows you to check if a single package name is available on the npm registry. The code sample demonstrates how to use the npm-name package to check the availability of 'some-package-name'.
const npmName = require('npm-name');
(async () => {
const isAvailable = await npmName('some-package-name');
console.log(isAvailable ? 'Available' : 'Taken');
})();
Check multiple package names
This feature allows you to check the availability of multiple package names at once. The code sample shows how to check the availability of 'package-one' and 'package-two' using the npm-name package.
const npmName = require('npm-name');
(async () => {
const result = await npmName.many(['package-one', 'package-two']);
console.log(result);
})();
Check scoped package name
This feature allows you to check the availability of a scoped package name. The code sample demonstrates how to check if '@scope/some-package-name' is available on the npm registry.
const npmName = require('npm-name');
(async () => {
const isAvailable = await npmName('@scope/some-package-name');
console.log(isAvailable ? 'Available' : 'Taken');
})();
The npm-name-cli package is a command-line interface tool for checking the availability of npm package names. While npm-name is a library that can be integrated into other Node.js applications, npm-name-cli is specifically designed for use in the terminal, making it a good choice for developers who prefer command-line tools.
Check whether a package or organization name is available on npm
$ npm install npm-name
import npmName from 'npm-name';
// Check a package name
console.log(await npmName('chalk'));
//=> false
// Check an organization name
console.log(await npmName('@ava'));
//=> false
console.log(await npmName('@abc123'));
//=> true
try {
await npmName('_ABC');
} catch (error) {
console.log(error.message);
// Invalid package name: _ABC
// - name cannot start with an underscore
// - name can no longer contain capital letters
}
Check whether a package/organization name is available (not registered) on npm.
An organization name should start with @
and should not be a scoped package.
Returns a Promise<boolean>
of whether the given name is available.
Type: string
Name to check.
Type: object
Default: User's configured npm registry URL.
Registry URL to check name availability against.
Note: You're unlikely to need this option. Most use-cases are best solved by using the default. You should only use this option if you need to check a package name against a specific registry.
Check whether multiple package/organization names are available (not registered) on npm.
Returns a Promise<Map>
of name and status.
import {npmNameMany} from 'npm-name';
const result = await npmNameMany(['chalk', '@sindresorhus/is', 'abc123']);
console.log(result.get('chalk'));
//=> false
console.log(result.get('@sindresorhus/is'));
//=> false
console.log(result.get('abc123'));
//=> true
Type: string[]
Multiple names to check.
Type: object
Same as npmName()
.
FAQs
Check whether a package or organization name is available on npm
The npm package npm-name receives a total of 163,531 weekly downloads. As such, npm-name popularity was classified as popular.
We found that npm-name demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.