UseGetDirname
katanakit-js / useGetDirname
Function: useGetDirname()
Section titled “Function: useGetDirname()”function useGetDirname(importMetaUrl): Promise<string>;Defined in: infrastructure/filesystem/path.service.ts:63
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/.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
importMetaUrl |
string |
Your module’s import.meta.url. |
Returns
Section titled “Returns”Promise<string>
The absolute directory that contains the module.
Example
Section titled “Example”import { useGetDirname } from "katanakit-js";
const dir = await useGetDirname(import.meta.url);// "<project>/src/features/books"