You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

path

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

path

Node.JS path module


Version published
Maintainers
3
Created

Package description

What is path?

The 'path' npm package is a core module in Node.js that provides utilities for working with file and directory paths. It can be used to perform operations such as parsing and formatting paths, joining and resolving paths, and extracting components of a path like the directory name, base name, or extension.

What are path's main functionalities?

Path Normalization

Normalizes the given path, resolving '..' and '.' segments and multiple slashes.

const path = require('path');
const normalizedPath = path.normalize('/users//test/../test1//file/');

Join Paths

Joins all given path segments together using the platform-specific separator as a delimiter.

const path = require('path');
const joinedPath = path.join('/first', 'second', 'file.txt');

Resolve Path

Resolves a sequence of paths or path segments into an absolute path.

const path = require('path');
const resolvedPath = path.resolve('first', '/second', 'file.txt');

Path Segments

Provides methods to extract the directory name, base name, and extension from a path.

const path = require('path');
const dirname = path.dirname('/first/second/file.txt');
const basename = path.basename('/first/second/file.txt');
const extname = path.extname('/first/second/file.txt');

Path Parsing

Returns an object whose properties represent significant elements of the path.

const path = require('path');
const parsedPath = path.parse('/home/user/dir/file.txt');

Other packages similar to path

Readme

Source

path

This is an exact copy of the NodeJS ’path’ module published to the NPM registry.

Documentation

Install

$ npm install --save path

License

MIT

Keywords

FAQs

Package last updated on 13 Sep 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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc