Documentation ¶
Index ¶
- func MkdirAll(mode fsutil.PathType, path string, perm fs.FileMode) error
- func ReadFile(mode fsutil.PathType, path string) ([]byte, error)
- func ReadFiles(paths []fsutil.Path, sem gtools.Semaphore) ([][]byte, error)
- func ReadPartial(mode fsutil.PathType, path string, start int64, end int64) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MkdirAll ¶
MkdirAll creates a directory with the given package name and operation. It joins the operation path with the package name, replacing any '/' with the OS-specific path separator. The directory is created with permissions to read, write, and execute for all users.
Args:
mode (fsutil.PathType): The type of path to construct (e.g., relative or root). path (string): The path to the directory to create. perm (fs.FileMode): The permissions to apply to the created directory.
Returns:
error: An error if the directory cannot be created, or nil if successful.
func ReadFile ¶
ReadFile reads the contents of a file at the specified path. The path is resolved based on the provided mode, which can be either Relative or Root.
Args:
mode (fsutil.PathType): The type of path to resolve. path (string): The path to the file.
Returns:
([]byte, error): The contents of the file as a byte slice, or an error if the file cannot be read.
func ReadFiles ¶
ReadFiles reads the contents of multiple files concurrently.
Args:
paths ([]fsutil.Path): A slice of file paths to read. sem (gtools.Semaphore): A semaphore to limit concurrency.
Returns:
([][]byte, error): A slice of byte slices containing the file contents, or an error if any file cannot be read.
func ReadPartial ¶
ReadPartial reads a partial content of a file.
It takes a file path, a start position, and an end position as input, and returns the content of the file within the specified range. If an error occurs during the read operation, it returns an error.
Types ¶
This section is empty.