java.lang.Object
io.agentscope.extensions.sandbox.kubernetes.client.Filesystem

public class Filesystem extends Object
File operations inside a sandbox via the runtime HTTP API.
  • Constructor Details

  • Method Details

    • write

      public void write(String path, byte[] content)
      Writes content to a file in the sandbox.
      Parameters:
      path - relative destination path
      content - file bytes
    • write

      public void write(String path, byte[] content, Duration timeout, boolean allowUnsafePaths)
      Writes content to a file in the sandbox.
      Parameters:
      path - destination path
      content - file bytes
      timeout - request timeout
      allowUnsafePaths - when false, rejects absolute paths and ..
    • write

      public void write(String path, String content)
      Writes string content (UTF-8) to a file in the sandbox.
      Parameters:
      path - relative destination path
      content - text content
    • read

      public byte[] read(String path)
      Reads a file from the sandbox.
      Parameters:
      path - file path
      Returns:
      file bytes
    • read

      public byte[] read(String path, Duration timeout, boolean allowUnsafePaths)
      Reads a file from the sandbox.
      Parameters:
      path - file path
      timeout - request timeout
      allowUnsafePaths - when false, rejects absolute paths and ..
      Returns:
      file bytes
    • list

      public List<FileEntry> list(String path)
      Lists entries in a directory.
      Parameters:
      path - directory path
      Returns:
      file entries
    • list

      public List<FileEntry> list(String path, Duration timeout)
      Lists entries in a directory.
      Parameters:
      path - directory path
      timeout - request timeout
      Returns:
      file entries
    • exists

      public boolean exists(String path)
      Checks whether a path exists in the sandbox.
      Parameters:
      path - path to check
      Returns:
      true if exists
    • exists

      public boolean exists(String path, Duration timeout)
      Checks whether a path exists in the sandbox.
      Parameters:
      path - path to check
      timeout - request timeout
      Returns:
      true if exists