flix

0.69.3

Fs.Glob

eff GlobSource

An effect used to find files matching a glob pattern.

Use the Glob.runWithFileSystem handler.

Operations

def glob(base: String, pattern: String): Result[IoError, List[String]] \ Glob Source

Returns a list of paths under base that match the given glob pattern.

Definitions

def handle(f: a -> b \ ef): a -> b \ (ef - Glob) + IO Source

Handles the Glob effect of the given function f.

In other words, re-interprets the Glob effect using the IO effect.

def runWithFileSystem(f: Unit -> a \ ef): a \ (ef - Glob) + FileSystem Source

Handles the Glob effect of the given function f using the FileSystem effect.

@DefaultHandler
def runWithIO(f: Unit -> a \ ef): a \ (ef - Glob) + IO Source

Runs the Glob effect of the given function f.

In other words, re-interprets the Glob effect using the IO effect.

def withAllowGlob(patterns: Nel[String], f: Unit -> a \ ef): a \ (ef - Glob) + Glob Source

Middleware that intercepts the Glob effect, validating that all base paths match at least one of the given glob patterns. Rejects paths that do not match with a PermissionDenied error.

def withAllowList(allowedDirs: Nel[String], f: Unit -> a \ ef): a \ (ef - Glob) + Glob Source

Middleware that intercepts the Glob effect, validating that all base paths resolve within one of the given allowedDirs. Rejects paths outside the allow list with a PermissionDenied error.

def withBaseDir(baseDir: String, f: Unit -> a \ ef): a \ (ef - Glob) + Glob Source

Middleware that intercepts the Glob effect, resolving all file paths relative to the given baseDir using Java's Path.resolve semantics.

Absolute paths are passed through unchanged.

def withChroot(chrootDir: String, f: Unit -> a \ ef): a \ (ef - Glob) + Glob Source

Middleware that intercepts the Glob effect, validating that all base paths resolve within the given chrootDir. Rejects paths that escape the chroot with a PermissionDenied error.

def withDenyGlob(patterns: Nel[String], f: Unit -> a \ ef): a \ (ef - Glob) + Glob Source

Middleware that intercepts the Glob effect, validating that all base paths do not match any of the given glob patterns. Rejects paths that match a denied pattern with a PermissionDenied error.

def withDenyList(deniedDirs: Nel[String], f: Unit -> a \ ef): a \ (ef - Glob) + Glob Source

Middleware that intercepts the Glob effect, validating that all base paths do not resolve within any of the given deniedDirs. Rejects paths inside a denied directory with a PermissionDenied error.

def withLogging(f: Unit -> a \ ef): a \ (ef - Glob) + Glob + Logger Source

Middleware that intercepts the Glob effect, logging each operation and its result via the Logger effect.

Successful operations are logged at Debug level; errors at Warn.