stdfilu - anssihalmeaho/funl GitHub Wiki

stdfilu

Provides more utilities for file handling.

slurp

Reads whole file content and return is as value (opaque bytearray). In case of error runtime error is generated.

type: procedure

Format:

call(stdfilu.slurp file-name:string) -> opaque:bytearray

read-file

Reads whole file content.

type: procedure

Format:

call(stdfilu.read-file file-name:string) -> list(ok:bool error:string content:bytearray)

Return value is list containing:

  1. bool value, true if success, false if failure
  2. error description in case of failure (string)
  3. file content (opaque bytearray)

get-files-by-ext

Returns list of files (list: string) in given path (string, 1st argument) which have given extension (string, 2nd argument).

type: procedure

Format:

call(stdfilu.get-files-by-ext <path-string> <extension-string>) -> list (of strings)

get-subdirs

Returns list of directories (list: string) in given path (string, 1st argument).

type: procedure

Format:

call(stdfilu.get-subdirs <path-string>) -> list (of strings)

get-nondirs

Returns list of non-directory files (list: string) in given path (string, 1st argument).

type: procedure

Format:

call(stdfilu.get-nondirs <path-string>) -> list (of strings)