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

commondir

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

commondir

compute the closest common parent for file paths

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
25M
increased by5.67%
Maintainers
1
Weekly downloads
 
Created

What is commondir?

The commondir npm package is a simple utility that helps you find the common parent directory among an array of file paths. This can be particularly useful in file system operations where you need to determine the shared base directory for a group of files.

What are commondir's main functionalities?

Finding common directory

This feature allows you to find the common parent directory from an array of file paths. In the provided code, the common directory for '/usr/lib/node_modules' and '/usr/lib/node' is calculated, which results in '/usr/lib'.

const commondir = require('commondir');
const paths = ['/usr/lib/node_modules', '/usr/lib/node'];
const commonPath = commondir(paths);
console.log(commonPath); // Outputs: '/usr/lib'

Other packages similar to commondir

Keywords

FAQs

Package last updated on 14 Mar 2015

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