osx - OS Operations
Overview
The osx module provides operating system utilities for file and directory operations with enhanced functionality.
Functions
Exists()
Check if path exists.
Parameters:
path- Path to check
Returns:
- true if path exists
- false otherwise
Example:
IsDir()
Check if path is a directory.
Parameters:
path- Path to check
Returns:
- true if path is a directory
- false otherwise
Example:
IsFile()
Check if path is a file.
Parameters:
path- Path to check
Returns:
- true if path is a file
- false otherwise
Example:
Exist()
Check if path exists (alias for Exists).
Parameters:
path- Path to check
Returns:
- true if path exists
- false otherwise
Example:
FsHasFile()
Check if file exists in filesystem.
Parameters:
fs- Filesystem interfacepath- Path to check
Returns:
- true if file exists
- false otherwise
Example:
RenameForce()
Rename file, removing destination if exists.
Parameters:
oldpath- Source pathnewpath- Destination path
Returns:
- Error if operation fails
Example:
Copy()
Copy file from source to destination.
Parameters:
src- Source file pathdst- Destination file path
Returns:
- Error if operation fails
Example:
Usage Patterns
File Existence Check
Directory Operations
File Copy with Backup
Safe Rename
Batch File Operations
Best Practices
Error Handling
File System Checks
Atomic Operations
Related Documentation
- runtime - Runtime information
- config - Configuration management
- API Documentation
- Module Overview