Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pnpm/read-modules-dir

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pnpm/read-modules-dir

Finds all direct packages in node_modules

  • 1000.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
279K
increased by9.31%
Maintainers
2
Weekly downloads
 
Created

What is @pnpm/read-modules-dir?

@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.

What are @pnpm/read-modules-dir's main functionalities?

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();

Other packages similar to @pnpm/read-modules-dir

Keywords

FAQs

Package last updated on 29 Nov 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc