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

path-type

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

path-type

Check if a path is a file, directory, or symlink

  • 6.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
59M
decreased by-3.09%
Maintainers
1
Weekly downloads
 
Created

What is path-type?

The path-type npm package is a simple utility that provides functions to check the type of a filesystem path. It can determine whether a path is a file, directory, symbolic link, etc. It is useful for validating paths and handling them conditionally based on their type.

What are path-type's main functionalities?

isFile

Checks if a path is a file.

const pathType = require('path-type');

pathType.isFile('source.js').then(isFile => {
  console.log(isFile); //=> true or false
});

isDirectory

Checks if a path is a directory.

const pathType = require('path-type');

pathType.isDirectory('source').then(isDirectory => {
  console.log(isDirectory); //=> true or false
});

isSymlink

Checks if a path is a symbolic link.

const pathType = require('path-type');

pathType.isSymlink('link').then(isSymlink => {
  console.log(isSymlink); //=> true or false
});

Other packages similar to path-type

Keywords

FAQs

Package last updated on 26 Jul 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