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.
@pnpm/read-modules-dir
Advanced tools
@pnpm/read-modules-dir is an npm package that allows you to read the contents of the node_modules directory. It provides a simple API to list all the packages installed in a node_modules directory, which can be useful for various tasks such as auditing dependencies, generating reports, or performing custom operations on installed packages.
List all packages in node_modules
This feature allows you to list all the packages in a specified node_modules directory. The code sample demonstrates how to use the package to read the contents of the node_modules directory and log the list of packages to the console.
const readModulesDir = require('@pnpm/read-modules-dir');
async function listPackages() {
const packages = await readModulesDir('path/to/node_modules');
console.log(packages);
}
listPackages();
Handle scoped packages
This feature allows you to handle scoped packages specifically. The code sample demonstrates how to filter and list only the scoped packages from the node_modules directory.
const readModulesDir = require('@pnpm/read-modules-dir');
async function listScopedPackages() {
const packages = await readModulesDir('path/to/node_modules');
const scopedPackages = packages.filter(pkg => pkg.startsWith('@'));
console.log(scopedPackages);
}
listScopedPackages();
The 'read-installed' package reads the installed packages in a node_modules directory and returns a tree structure of the dependencies. It provides more detailed information about each package, including version, dependencies, and more. Compared to @pnpm/read-modules-dir, 'read-installed' offers a more comprehensive view of the installed packages but may be more complex to use.
The 'npm-ls' package is a command-line tool that lists all the installed packages in a node_modules directory, similar to the 'npm ls' command. It provides a hierarchical view of the dependencies. Compared to @pnpm/read-modules-dir, 'npm-ls' is more focused on providing a command-line interface and may not be as easily integrated into custom scripts.
Finds all direct packages in node_modules
FAQs
Finds all direct packages in node_modules
The npm package @pnpm/read-modules-dir receives a total of 218,747 weekly downloads. As such, @pnpm/read-modules-dir popularity was classified as popular.
We found that @pnpm/read-modules-dir demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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.