1717namespace Fiscalapi . XmlDownloader . FileStorage ;
1818
1919/// <summary>
20- /// Interface for cross-platform file system operations
21- /// Designed to support multiple implementations like local file system, cloud storage, etc.
20+ /// Interface for file system operations.
2221/// </summary>
2322public interface IFileStorageService
2423{
25- /// <summary>
26- /// Check if a file exists at the specified path
27- /// </summary>
28- bool FileExists ( string filePath ) ;
29-
3024 /// <summary>
3125 /// Check if a directory exists at the specified path
3226 /// </summary>
27+ /// <param name="directoryPath">Full path to the directory</param>
28+ /// <returns>True if directory exists</returns>
3329 bool DirectoryExists ( string directoryPath ) ;
3430
3531 /// <summary>
3632 /// Delete all files and folders recursively from the specified directory
3733 /// </summary>
38- Task CleanDirectoryAsync ( string directoryPath , CancellationToken cancellationToken = default ) ;
34+ /// <param name="directoryPath">Full path to the directory to clean</param>
35+ /// <param name="cancellationToken">Cancellation token</param>
36+ void CleanDirectory ( string directoryPath , CancellationToken cancellationToken = default ) ;
3937
4038 /// <summary>
41- /// Extract a ZIP file to the specified destination path or default directory if not specified
39+ /// Create a directory if it doesn't exist
4240 /// </summary>
43- /// <param name="zipFilePath">Package .zip path</param>
44- /// <param name="extractToPath">Path to write unzip files</param>
45- /// <param name="cancellationToken">CancellationToken</param>
46- /// <returns>Completion Task</returns>
47- Task ExtractZipFileAsync ( string zipFilePath , string ? extractToPath = null ,
48- CancellationToken cancellationToken = default ) ;
41+ /// <param name="directoryPath">Full path to the directory to create</param>
42+ void CreateDirectoryIfNotExist ( string directoryPath ) ;
4943
5044 /// <summary>
51- /// Ensure required directories exist based on configuration settings
45+ /// Check if a file exists at the specified path
5246 /// </summary>
53- Task EnsureDirectoriesAsync ( CancellationToken cancellationToken = default ) ;
47+ /// <param name="fullFilePath">Full path to the file</param>
48+ /// <returns>True if file exists</returns>
49+ bool FileExists ( string fullFilePath ) ;
5450
5551 /// <summary>
56- /// Get a list of files from the specified directory with optional file extension filter
52+ /// Extract a ZIP file to the specified destination path
5753 /// </summary>
58- Task < List < FileDetails > > GetFilesAsync ( string directoryPath , string ? fileExtension = null ,
54+ /// <param name="fullFilePath">Full path to the ZIP file</param>
55+ /// <param name="extractToPath">Path to extract files to</param>
56+ /// <param name="cancellationToken">Cancellation token</param>
57+ /// <returns>Completion Task</returns>
58+ void ExtractZipFile ( string fullFilePath , string extractToPath ,
5959 CancellationToken cancellationToken = default ) ;
6060
61+ /// <summary>
62+ /// Get a list of files from the specified directory with optional file extension filter
63+ /// </summary>
64+ /// <param name="directoryPath">Full path to the directory</param>
65+ /// <param name="fileExtension">File extension filter (optional)</param>
66+ /// <returns>List of file details</returns>
67+ List < FileDetails > GetFiles ( string directoryPath , string ? fileExtension = null ) ;
68+
6169 /// <summary>
6270 /// Write binary data to a file
6371 /// </summary>
64- Task WriteFileAsync ( string filePath , byte [ ] data , CancellationToken cancellationToken = default ) ;
72+ /// <param name="fullFilePath">Full path to the file</param>
73+ /// <param name="data">Binary data to write</param>
74+ /// <param name="cancellationToken">Cancellation token</param>
75+ Task WriteFileAsync ( string fullFilePath , byte [ ] data , CancellationToken cancellationToken = default ) ;
6576
6677 /// <summary>
6778 /// Write base64 encoded data to a file
6879 /// </summary>
69- Task WriteFileAsync ( string filePath , string base64Data , CancellationToken cancellationToken = default ) ;
80+ /// <param name="fullFilePath">Full path to the file</param>
81+ /// <param name="base64Data">Base64 encoded data to write</param>
82+ /// <param name="cancellationToken">Cancellation token</param>
83+ Task WriteFileAsync ( string fullFilePath , string base64Data , CancellationToken cancellationToken = default ) ;
7084
7185 /// <summary>
7286 /// Read file content as byte array
7387 /// </summary>
74- Task < byte [ ] > ReadFileAsync ( string filePath , CancellationToken cancellationToken = default ) ;
88+ /// <param name="fullFilePath">Full path to the file</param>
89+ /// <param name="cancellationToken">Cancellation token</param>
90+ /// <returns>File content as byte array</returns>
91+ Task < byte [ ] > ReadFileAsync ( string fullFilePath , CancellationToken cancellationToken = default ) ;
7592
7693 /// <summary>
7794 /// Read file content as string
7895 /// </summary>
79- Task < string > ReadFileContentAsync ( string filePath , CancellationToken cancellationToken = default ) ;
80-
81- /// <summary>
82- /// Copy a file from source to destination
83- /// </summary>
84- Task < bool > CopyFileAsync ( string sourceFilePath , string destinationFilePath , bool overwrite = false ,
85- CancellationToken cancellationToken = default ) ;
86-
87- /// <summary>
88- /// Move a file from source to destination
89- /// </summary>
90- Task < bool > MoveFileAsync ( string sourceFilePath , string destinationFilePath ,
91- CancellationToken cancellationToken = default ) ;
96+ /// <param name="fullFilePath">Full path to the file</param>
97+ /// <param name="cancellationToken">Cancellation token</param>
98+ /// <returns>File content as string</returns>
99+ Task < string > ReadFileContentAsync ( string fullFilePath , CancellationToken cancellationToken = default ) ;
92100
93101 /// <summary>
94102 /// Delete a file
95103 /// </summary>
96- Task < bool > DeleteFileAsync ( string filePath , CancellationToken cancellationToken = default ) ;
97-
98- /// <summary>
99- /// Get file size in bytes
100- /// </summary>
101- Task < long > GetFileSizeAsync ( string filePath , CancellationToken cancellationToken = default ) ;
102-
103- /// <summary>
104- /// Create a directory if it doesn't exist
105- /// </summary>
106- Task CreateDirectoryAsync ( string directoryPath , CancellationToken cancellationToken = default ) ;
104+ /// <param name="fullFilePath">Full path to the file</param>
105+ /// <returns>True if file was deleted successfully</returns>
106+ void DeleteFile ( string fullFilePath ) ;
107107}
0 commit comments