← all modules

Sky.Core.File

Sky.Core.File
  Sky.Core.File — filesystem I/O (Layer 3 Sky source).

Types
  type FileKind = File | Directory | Symlink | Other
  type alias FileInfo = { kind : FileKind , size : Int , modified : Int , mode : Int }
  type alias RawInfo = { kind : Int , size : Int , modified : Int , mode : Int }

Values
  append : String -> String -> Task Error ()
      `append path content` — appends to the end of the file
  chmod : Int -> String -> Task Error ()
      `chmod mode path` — set the permission bits:
  copy : String -> String -> Task Error ()
  exists : String -> Task Error Bool
  isDir : String -> Task Error Bool
  lstat : String -> Task Error FileInfo
      `lstat path` — like `stat`, but a symlink is described itself (kind
  mkdirAll : String -> Task Error ()
      `mkdirAll path` — like `mkdir -p`.  Creates every intermediate
  permissions : Int -> Int -> Int -> Int
      `permissions owner group other` — a mode from its three octal digits
  readDir : String -> Task Error (List String)
  readFile : String -> Task Error String
  readFileBytes : String -> Task Error (List Int)
      Read raw bytes as a list of Int.  Use for binary content
  readFileLimit : String -> Int -> Task Error String
      `readFileLimit path maxBytes` — read the file, refusing one larger than
  readLink : String -> Task Error String
      `readLink path` — the target a symlink stores, exactly as written
  realPath : String -> Task Error String
      `realPath path` — the absolute path with every symlink, `.` and `..`
  remove : String -> Task Error ()
  rename : String -> String -> Task Error ()
  resolveWithin : String -> String -> Task Error String
      `resolveWithin root path` — resolve `path` (a relative path is taken
  stat : String -> Task Error FileInfo
      `stat path` — the metadata of `path`, following a symlink to its
  tempDir : String -> Task Error String
      `tempDir prefix` — create a uniquely-named directory in the
  tempFile : String -> Task Error String
      `tempFile prefix` — create a uniquely-named file in the system
  writeFile : String -> String -> Task Error ()
      `writeFile path content` — overwrites the file.