From 8bf065acb7d6c58849f0be96eba33ebdcdc5616b Mon Sep 17 00:00:00 2001 From: Matt Solomon Date: Mon, 3 Oct 2022 18:14:01 -0700 Subject: [PATCH] feat: add cheats to read/write binary files --- src/Vm.sol | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Vm.sol b/src/Vm.sol index 378227e3..fa375db0 100644 --- a/src/Vm.sol +++ b/src/Vm.sol @@ -119,6 +119,8 @@ interface Vm { // Reads the entire content of file to string, (path) => (data) function readFile(string calldata) external returns (string memory); + // Reads the entire content of file as binary. Path is relative to the project root. (path) => (data) + function readFileBinary(string calldata) external returns (bytes memory); // Get the path of the current project root function projectRoot() external returns (string memory); // Reads next line of file to string, (path) => (line) @@ -126,6 +128,9 @@ interface Vm { // Writes data to file, creating a file if it does not exist, and entirely replacing its contents if it does. // (path, data) => () function writeFile(string calldata, string calldata) external; + // Writes binary data to a file, creating a file if it does not exist, and entirely replacing its contents if it does. + // Path is relative to the project root. (path, data) => () + function writeFileBinary(string calldata, bytes calldata) external; // Writes line to file, creating a file if it does not exist. // (path, data) => () function writeLine(string calldata, string calldata) external;