@bearz/path
TypeScript icon, indicating that this package has built-in type declarations

0.0.0 • Public • Published

@bearz/path

Overview

Path utilties for operating system file paths that is a re-package of the @std/path module with minor changes to enable it to work in node and bun.

@std/path which is based upon browsify's implementation of path.

logo

JSR npm version GitHub version

Documentation

Documentation is available on jsr.io

A list of other modules can be found at github.com/bearz-io/js

Usage

import { resolve, join, isAbsolute, basename, dirname } from "@bearz/path";

console.log(isAbsolute("./test"));

const dir = resolve("./test");
const file = join(dir, "text.txt");
console.log(dir);
console.log(isAbsolute(dir));
console.log(file);
console.log(dirname(file));
console.log(basename(file))

Functions

  • basename - Return the last portion of a path.
  • common - Determines the common path from a set of paths for the given OS.
  • dirname - Return the directory path of a path.
  • extname - Return the extension of the path with leading period (".").
  • format - Generate a path from a ParsedPath object.
  • fromFileUrl - Converts a file URL to a path string.
  • globToRegexp - Converts a glob string to a regular expression.
  • isAbsolute - Verifies whether provided path is absolute.
  • isGlob - Test whether the given string is a glob.
  • joinGlobs - Joins a sequence of globs, then normalizes the resulting glob.
  • join - Joins a sequence of paths, then normalizes the resulting path.
  • normalizeGlob - Normalizes a glob string.
  • normalize - Normalize the path, resolving '..' and '.' segments.
  • parse - Return an object containing the parsed components of the path.
  • relative - Return the relative path from from to to based on current working direct.
  • resolve - Resolves path segments into a path.
  • toFileUrl - Converts a path string to a file URL.
  • toNamespacedPath - Resolves path to a namespace path. This is a no-op on non-windows systems.

Notes

@bearz/path is repackaging @std/path to enable it for node/bun and avoid a depdendency on jsr when shipping @bearz modules to npm avoid issues with shimming between @std/path and node:path and include the extra methods such as toFileUrl and fromFileUrl.

License

MIT License

Readme

Keywords

Package Sidebar

Install

npm i @bearz/path

Homepage

bearz.io

Weekly Downloads

45

Version

0.0.0

License

MIT

Unpacked Size

288 kB

Total Files

230

Last publish

Collaborators

  • jolt9dev
  • hyprxdev