Module

Yoga.Om.Node

Package
purescript-yoga-om-node
Repository
rowtype-yoga/purescript-yoga-om-node

#readFile Source

readFile :: forall ctx err. FilePath -> Om ctx (FileError err) Buffer

Read a file as a Buffer

#readTextFile Source

readTextFile :: forall ctx err. FilePath -> Om ctx (FileError err) String

Read a file as text with UTF-8 encoding

#writeFile Source

writeFile :: forall ctx err. FilePath -> Buffer -> Om ctx (FileError err) Unit

Write a Buffer to a file

#writeTextFile Source

writeTextFile :: forall ctx err. FilePath -> String -> Om ctx (FileError err) Unit

Write text to a file with UTF-8 encoding

#appendFile Source

appendFile :: forall ctx err. FilePath -> Buffer -> Om ctx (FileError err) Unit

Append a Buffer to a file

#appendTextFile Source

appendTextFile :: forall ctx err. FilePath -> String -> Om ctx (FileError err) Unit

Append text to a file with UTF-8 encoding

#exists Source

exists :: forall ctx err. FilePath -> Om ctx err Boolean

Check if a file or directory exists

#mkdir Source

mkdir :: forall ctx err. FilePath -> Om ctx (FileError err) Unit

Create a directory

#rmdir Source

rmdir :: forall ctx err. FilePath -> Om ctx (FileError err) Unit

Remove a directory

#getEnv Source

getEnv :: forall ctx err. String -> Om ctx (EnvError err) String

Get an environment variable, throwing an error if not found

#lookupEnv Source

lookupEnv :: forall ctx err. String -> Om ctx err (Maybe String)

Look up an environment variable, returning Maybe

#setEnv Source

setEnv :: forall ctx err. String -> String -> Om ctx err Unit

Set an environment variable

#cwd Source

cwd :: forall ctx err. Om ctx err FilePath

Get the current working directory

#FileError Source

type FileError :: Row Type -> Row Typetype FileError r = (fileNotFound :: { path :: FilePath }, fileReadError :: { message :: String, path :: FilePath }, fileSystemError :: { message :: String }, fileWriteError :: { message :: String, path :: FilePath } | r)

Error types for file operations

#EnvError Source

type EnvError :: Row Type -> Row Typetype EnvError r = (envNotFound :: { variable :: String } | r)

Error types for environment variable operations