Skip to content

setCurrentWorkingDirectory

Changes the current working directory.

Example

ts
import { 
setCurrentWorkingDirectory
} from "@duplojs/server-utils";
import {
E
} from "@duplojs/utils";
const
result
=
setCurrentWorkingDirectory
("/tmp/project");
// result: E.Fail | E.Ok if (
E
.
isRight
(
result
)) {
// the action was successful }

Syntax

typescript
function setCurrentWorkingDirectory(
  path: string | URL
): E.Fail | E.Ok

Parameters

  • path (string | URL) : target path. If a URL is provided, it is decoded to a file path.

Return value

  • E.Ok : if the directory change succeeded.
  • E.Fail : if the directory change failed.

See also

Released under the MIT license.