Scoop API

scoop:scoop.platform:0.1.0

scoop.platform.fs

API

  • class DirectoryEntries

    An owned, single-pass directory cursor implementing both Iterable and Iterator. Close it when finished or when abandoning enumeration.

  • struct DirectoryEntry

    One directory entry's native name and path relative to the enumerated directory.

  • class File

    An owned native file handle with byte I/O, positioning, metadata, and explicit durability operations. Close it after use.

  • enum FileKind

    The operating-system kind of a filesystem entry.

  • struct FileMetadata

    A metadata snapshot containing kind, byte size, permission bits, access/modification/change times, and optional creation time.

  • struct OpenOptions

    Explicit file access and creation flags. POSIX permissions are subject to umask; Windows uses the default ACL; incompatible options are rejected.

  • class Path

    An immutable native byte path with no embedded NUL. Lexical operations do not access the filesystem or resolve symbolic links; equality compares stored bytes.

  • function canonicalize

    Resolves an existing path and its symbolic links into the operating system's canonical absolute path. Windows retains the extended path prefix returned by the system.

  • function copyNativeString

    Copies a readable NUL-terminated native byte string into OsString. The unsafe caller must keep the full region valid.

  • function copyTo

    Copies input to a destination and returns actual bytes transferred. Byte-source copies borrow both endpoints; path copies own their temporary handles and honor replaceExisting.

  • function createDirectories

    Creates missing path components as directories, preserving already existing directories.

  • function createDirectory

    Creates one directory with requested permissions, subject to umask.

  • function createSymbolicLink

    Creates a symbolic link at this path. On Windows, set targetIsDirectory for directory targets, including directories that do not yet exist. POSIX ignores this flag.

  • function createTempDirectory

    Creates a unique temporary directory in the chosen parent. The caller owns deletion responsibility.

  • function createTempFile

    Creates a unique temporary file in the chosen parent and returns its path. The caller owns deletion responsibility.

  • function delete

    Removes the selected file or empty directory.

  • function deleteRecursively

    Recursively removes a directory tree without following symbolic-link targets.

  • function entries

    Opens an owned, single-pass cursor over this directory.

  • function exists

    Tests whether path metadata is available; ordinary absence returns false while other platform failures propagate.

  • function metadata

    Queries path metadata, following symbolic links unless followLinks is false.

  • function moveTo

    Moves the path to the destination, replacing an existing entry only when requested.

  • function readAllBytes

    Collects all remaining input into an independent byte array. Path overloads open and close their own file handle.

  • function readSymbolicLink

    Reads the stored target without resolving it. Windows returns the actual symlink or junction substitute name, with an absolute NT prefix converted to its Win32 spelling.

  • function readText

    Reads all remaining bytes and validates them as UTF-8.

  • function readTextLossy

    Reads all remaining bytes as UTF-8, replacing malformed sequences.

  • function withLock

    Borrows a non-nested file lock and releases it on every exit.

  • function withNativePath

    Borrows the path as a NUL-terminated native byte string for the callback only.

  • function withNativeString

    Borrows a NUL-terminated native encoding for the callback. Embedded NUL is rejected and the pointer must not escape.

  • function writeAllBytes

    Writes all supplied bytes. Path overloads create/open and close their own file handle, with explicit append selection.

  • function writeText

    Writes the complete UTF-8 encoding of the text without appending a newline.