Pipeline.Utils.FileUtils (pipeline v0.0.1)
View SourceFile utility functions for pipeline file operations.
Provides comprehensive file manipulation capabilities including:
- File operations (copy, move, delete)
- File validation (existence, size, permissions)
- Format conversion (CSV, JSON, YAML, XML)
- Path resolution and workspace management
- Streaming operations for large files (>100MB)
- Memory-efficient file processing
Summary
Functions
Convert file format from source to destination.
Copy a file from source to destination with error handling.
Delete a file or directory with error handling.
Get file size efficiently.
List files in a directory with optional pattern matching.
Move a file from source to destination with error handling.
Resolve a path relative to the workspace directory.
Check if a file should be processed using streaming based on size.
Process a file with automatic streaming decision.
Copy a large file using streaming to avoid memory issues.
Process a large file line by line with a given function. Memory-efficient for large text files.
Read a file in chunks using streaming. Returns a stream that yields binary chunks.
Write data to a file using streaming.
Validate file properties according to given criteria.
Functions
Convert file format from source to destination.
Copy a file from source to destination with error handling.
Delete a file or directory with error handling.
@spec get_file_size(String.t()) :: {:ok, non_neg_integer()} | {:error, String.t()}
Get file size efficiently.
List files in a directory with optional pattern matching.
Move a file from source to destination with error handling.
Resolve a path relative to the workspace directory.
Check if a file should be processed using streaming based on size.
Process a file with automatic streaming decision.
Copy a large file using streaming to avoid memory issues.
@spec stream_process_lines(String.t(), (String.t() -> String.t())) :: {:ok, String.t()} | {:error, String.t()}
Process a large file line by line with a given function. Memory-efficient for large text files.
@spec stream_read_file(String.t()) :: File.Stream.t() | {:error, String.t()}
Read a file in chunks using streaming. Returns a stream that yields binary chunks.
@spec stream_write_file(String.t(), Enumerable.t()) :: :ok | {:error, String.t()}
Write data to a file using streaming.
Validate file properties according to given criteria.