/** * Checks whether the code runs in a Node.js-compatible runtime * (Node, Bun or Deno). Returns `false` in browsers and edge runtimes. * * @returns `true` when `process.versions.node` is available. * * @example * ```ts * import { useIsNode } from "katanakit-js"; * * if (useIsNode()) { * // safe to use node:fs / node:path * } * ``` */ export declare const useIsNode: () => boolean; /** * Resolves the directory of a module from its `import.meta.url`. * * Unlike `import.meta.dirname`, this works for any module you pass in, * so a consumer's app resolves its own paths — never KatanaKit's `dist/`. * * @param importMetaUrl - Your module's `import.meta.url`. * @returns The absolute directory that contains the module. * * @example * ```ts * import { useGetDirname } from "katanakit-js"; * * const dir = await useGetDirname(import.meta.url); * // "/src/features/books" * ``` */ export declare function useGetDirname(importMetaUrl: string): Promise; /** * Resolves a sequence of path segments into an absolute path. * Relative segments resolve against `process.cwd()`; if the first * segment is absolute (like a `useGetDirname` result), cwd is ignored. * * @param segments - Path segments to resolve. * @returns The resolved absolute path. * * @example * ```ts * const base = await useGetDirname(import.meta.url); * const file = await useResolvePath(base, "../data/books.json"); * ``` */ export declare function useResolvePath(...segments: string[]): Promise; /** * Joins path segments without resolving against `process.cwd()`. * * @param segments - Path segments to join. * @returns The joined (possibly relative) path. * * @example * ```ts * await useJoinPath("data", "books.json"); // "data/books.json" * ``` */ export declare function useJoinPath(...segments: string[]): Promise; /** * Computes the relative path from `from` to `to`. * * @param from - Origin path. * @param to - Destination path. * @returns The relative path between both. * * @example * ```ts * await useGetRelativePath("/app/src", "/app/data/books.json"); // "../data/books.json" * ``` */ export declare function useGetRelativePath(from: string, to: string): Promise; /** * Returns the last portion of a path (file name). * * @param filePath - The path to inspect. * @param suffix - Optional suffix to strip (e.g. `".json"`). * @returns The base name. * * @example * ```ts * await useGetBasename("/data/books.json"); // "books.json" * await useGetBasename("/data/books.json", ".json"); // "books" * ``` */ export declare function useGetBasename(filePath: string, suffix?: string): Promise; /** * Returns the extension of a path, including the leading dot. * * @param filePath - The path to inspect. * @returns The extension (`""` when there is none). * * @example * ```ts * await useGetFileExtension("/data/books.json"); // ".json" * ``` */ export declare function useGetFileExtension(filePath: string): Promise; /** * Returns the current working directory of the process (where the * command was launched), or `null` outside a Node-compatible runtime. * Use it for project-relative paths; use {@link useGetDirname} for * file-relative paths. * * @returns The cwd, or `null` in browsers/edge runtimes. * * @example * ```ts * const cwd = useGetCwd(); // "/app" when launched from the project root * ``` */ export declare function useGetCwd(): string | null; //# sourceMappingURL=path.service.d.ts.map