path
import { path } from "@tynd/core/client";Small synchronous path utilities. Platform-aware via navigator.platform detection. No round-trip to Rust — these run entirely in the WebView / JS runtime.
sep(): "/" | "\\"
Platform path separator.
path.sep(); // "\\" on Windows, "/" elsewherejoin(...parts: string[]): string
Joins path segments with the platform separator, collapsing duplicate slashes.
path.join("/tmp", "notes", "hello.md"); // "/tmp/notes/hello.md"
path.join("C:\\", "Users", "me"); // "C:\\Users\\me" on WindowsEmpty strings are ignored.
dirname(p: string): string
Parent directory of the path.
path.dirname("/tmp/notes/hello.md"); // "/tmp/notes"
path.dirname("/tmp"); // ""basename(p: string, ext?: string): string
Last segment, optionally with an extension stripped.
path.basename("/tmp/notes/hello.md"); // "hello.md"
path.basename("/tmp/notes/hello.md", ".md"); // "hello"extname(p: string): string
File extension including the leading dot, or "" if none.
path.extname("hello.md"); // ".md"
path.extname("Makefile"); // ""Notes
- Synchronous. These functions do not return promises — they run in the WebView.
- No
resolve(),normalize(), orisAbsolute()— compose them yourself or useURL/ framework helpers if you need them. - Absolute paths are produced by joining from a known root (
await os.homeDir(), etc.) — not by aresolvefunction.
Related
Last updated on