Skip to content

Function: resourcesPath() ​

resourcesPath(): string | undefined

Get the directory of the resources of a packed application: the files declared by the lakutata.resources field of its package.json, at their to paths (extracted first when it runs in a single executable).

Returns ​

string | undefined

The absolute path of the directory, or undefined when the application does not run packed: it then locates its resources itself (in development, the directory they are built in).

Example ​

typescript
import path from 'node:path'
import {resourcesPath} from 'lakutata'

//The web UI served by the application: its packed copy, or its build in development
const resources: string | undefined = resourcesPath()
const ui: string = resources ? path.join(resources, 'ui') : path.resolve('ui', 'dist')

Released under the MIT License.