TestimoX

API Reference

Class

FileSystemHelpers

Namespace ADPlayground.IO
Assembly ADPlayground
Modifiers static

File system utilities shared across hosts (CLI/PowerShell) and engine readers. Provides safe path resolution, size-capped reads, and disposable temp files with cleanup.

Inheritance

  • Object
  • FileSystemHelpers

Methods

public static TempFile CreateTempFile() #
Returns: TempFile

Creates a disposable temp file that is deleted on Dispose.

public static String ReadAllTextCapped(String path, Int64 maxBytes = 16777216, OversizePolicy policy = Throw) #
Returns: String

Reads all text from a file enforcing a maximum size.

Parameters

path System.String requiredposition: 0
Path to the file (relative paths resolved to full paths).
maxBytes System.Int64 = 16777216 optionalposition: 1
Maximum allowed size in bytes; default 16 MB.
policy ADPlayground.IO.FileSystemHelpers.OversizePolicy = Throw optionalposition: 2
Oversize handling policy (Throw or ReturnEmpty).

Returns

File contents, or empty string when policy is ReturnEmpty and the file is oversized.

Exceptions

  • ArgumentException – Thrown when the path is empty, file is missing, or exceeds the size and policy is Throw.
public static String RequireReadableFile(String path, Int64 maxBytes = 67108864, String[] allowedExtensions = null) #
Returns: String

Validates that path points to an existing readable file and enforces a maximum size. Returns the absolute normalized path when validation succeeds.

Parameters

path System.String requiredposition: 0
Input path; relative paths are resolved to full paths.
maxBytes System.Int64 = 67108864 optionalposition: 1
Maximum allowed file size in bytes (defaults to 64 MB).
allowedExtensions System.String[] = null optionalposition: 2
Optional whitelist of extensions (include dot), case-insensitive. When null, any extension is allowed.

Exceptions

  • ArgumentException – Thrown when the path is empty, file does not exist, exceeds size, or has a disallowed extension.