Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

path.parse need #6976

Closed
Closed
@litmit

Description

@litmit

When working with filenames its often need to split path to separate components simultaneously:

var dir = path.dirname(f);
var base = path.basename(f);
var ext= path.extname(f);

Internally all this functions uses universal parser splitPath that each time return all components of path. Moreover this parser returns the drive piece of path on Windows, but there is not any public API to achieve it.

It is possible to introduce new function in path module path.parse(f)?
path.parse must return object with next properties:

  • root - drive or UNC prefix (Windows specific)
  • dir directory name of a path (=== path.dirname() )
  • base last portion of a path (=== path.basename() )
  • ext extension (=== path.extname() )
  • name basename without extension and dot

Also, for completness, need the function path.format(pathObj) which takes a parsed path object and return a formatted path string.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @chrisdickinson@litmit@roryrjb

        Issue actions

          path.parse need · Issue #6976 · nodejs/node-v0.x-archive