diff --git a/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs b/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs index 41cde09571..f2dc91eaec 100644 --- a/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs +++ b/src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs @@ -231,6 +231,11 @@ public string read_file(string filePath) return File.ReadAllText(filePath, get_file_encoding(filePath)); } + public byte[] read_file_bytes(string filePath) + { + return File.ReadAllBytes(filePath); + } + public FileStream open_file_readonly(string filePath) { return File.OpenRead(filePath); diff --git a/src/chocolatey/infrastructure/filesystem/IFileSystem.cs b/src/chocolatey/infrastructure/filesystem/IFileSystem.cs index 1595959418..959a9205c9 100644 --- a/src/chocolatey/infrastructure/filesystem/IFileSystem.cs +++ b/src/chocolatey/infrastructure/filesystem/IFileSystem.cs @@ -196,6 +196,13 @@ public interface IFileSystem /// A string of the file contents string read_file(string filePath); + /// + /// Returns the contents of a file as bytes. + /// + /// The filepath. + /// A byte array of the file contents + byte[] read_file_bytes(string filePath); + /// /// Opens a file /// @@ -330,5 +337,6 @@ public interface IFileSystem /// The path. /// The attributes. void ensure_file_attribute_set(string path, FileAttributes attributes); + } } \ No newline at end of file