Skip to content

A tiny package for parsing file paths, with the same output as Node@18.19.0's path.parse function.

License

Notifications You must be signed in to change notification settings

fabiospampinato/tiny-path-parse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tiny Path Parse

A tiny package for parsing file paths, with the same output as Node@18.19.0's path.parse function.

Install

npm install tiny-path-parse

Usage

import parse from 'tiny-path-parse'; // Implementation depending on the current platform
import posix from 'nanopath/posix'; // Implementation for POSIX paths
import win32 from 'nanopath/win32'; // Implementation for Windows paths

// Let's parse a path with automatic posix/win32 flavor detection, based on process.platform

parse ( '/foo/bar.baz' ); // => { root: '/', dir: '/foo', base: 'bar.baz', name: 'bar', ext: '.baz' }

// Let's parse a path with the posix flavor

parse.posix ( '/foo/bar.baz' ); // => { root: '/', dir: '/foo', base: 'bar.baz', name: 'bar', ext: '.baz' }

// Let's parse a path with the win32 flavor

parse.win32 ( 'C:\\foo\\bar.baz' ); // => { root: 'C:\\', dir: 'C:\\foo', base: 'bar.baz', name: 'bar', ext: '.baz' }

License

MIT © Fabio Spampinato

About

A tiny package for parsing file paths, with the same output as Node@18.19.0's path.parse function.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published