Skip to content

setCurrentWorkingDirectory ​

Changes the current working directory. This version returns an Either result. If you prefer throwing behavior, use setCurrentWorkingDirectoryOrThrow.

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 }

Other examples ​

Throw variant ​

ts
import { 
setCurrentWorkingDirectoryOrThrow
} from "@duplojs/server-utils";
setCurrentWorkingDirectoryOrThrow
("/tmp/project");

Syntax ​

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

Parameters ​

  • path (string) : target path.

Return value ​

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

See also ​

Released under the MIT license.