The os module

The os module provides functions for interacting with the operating system.

Free functions

getCwd(): string

Returns the current working directory as a string.

getEnv(name: string): string | null

Gets the value of an environment variable by providing its name as a string. Returns the value as a string if the variable is found, or null if the variable is not set.

setCwd(path: string): void

Sets the current working directory to the specified absolute path. Raises IOError if the provided path is not absolute.

setEnv(name: string, value: string): void

Sets an environment variable with the provided name and value as strings.