0.0.4 • Published 7 months ago

@iohub/pathinfo v0.0.4

Weekly downloads
-
License
BSD
Repository
github
Last release
7 months ago

@iohub/pathinfo

Powerful path manipulation utilities for Node.js with zero dependencies.

npm version npm downloads npm license github commit activity

Features

  • Extract file names, extensions, and directory information
  • Asynchronous file existence checking
  • Zero dependencies
  • Modern ES modules support
  • Node.js >=22.0.0

Installation

# npm
npm install @iohub/pathinfo

# yarn
yarn add @iohub/pathinfo

# pnpm
pnpm add @iohub/pathinfo

Usage

import { pathToName, pathToNameExt, pathToEntry, pathToInfo, exists } from '@iohub/pathinfo'

// Extract file name without extension
pathToName('path/to/file.txt')  // => 'file'

// Get file name with extension
pathToNameExt('path/to/file.txt')  // => 'file.txt'

// Get file name and extension as array
pathToEntry('path/to/file.txt')  // => ['file', '.txt']

// Get complete path information
pathToInfo('path/to/file.txt')  // => { dir: 'path/to', doc: 'file', ext: '.txt' }

// Check if path exists
await exists('path/to/file.txt')  // => true/false

License

MIT © Hoyeung Wong

0.0.4

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago

0.0.1

7 months ago