Skip to content

Common ​

Cross-cutting helpers with no specific business use case. This namespace groups generic building blocks.

How to import? ​

All functions are exported from the main entry or via direct import (tree-shaking friendly).

typescript
import { getCurrentWorkDirectory } from "@duplojs/server-utils";
import * as DServerCommon from "@duplojs/server-utils/common";

Environment variables ​

environmentVariable ​

loads env variables from runtime and optional files, validates them, and returns an Either result. Throw variant available: environmentVariableOrThrow.

Current directory ​

getCurrentWorkDirectory ​

returns the current working directory for the active runtime. Throw variant available: getCurrentWorkDirectoryOrThrow.

setCurrentWorkingDirectory ​

changes the current working directory to a target directory. Throw variant available: setCurrentWorkingDirectoryOrThrow.

Process ​

getProcessArguments ​

returns process arguments provided from the command line.

exitProcess ​

stops the current process with an optional exit code.

Released under the MIT license.