From 4b7c6049ef9d40394eb823859c82cbf8d293430d Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 31 Jan 2024 22:15:22 -0500 Subject: refactor: load bytes in deno_graph (#22212) Upgrades deno_graph to 0.64 where deno_graph is now responsible for turning bytes into a string. This is in preparation for Wasm modules. --- test_util/src/fs.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test_util/src') diff --git a/test_util/src/fs.rs b/test_util/src/fs.rs index 17620276b..0e47a7503 100644 --- a/test_util/src/fs.rs +++ b/test_util/src/fs.rs @@ -118,6 +118,10 @@ impl PathRef { .with_context(|| format!("Could not read file: {}", self)) } + pub fn read_to_bytes_if_exists(&self) -> Result, anyhow::Error> { + fs::read(self).with_context(|| format!("Could not read file: {}", self)) + } + pub fn read_json(&self) -> TValue { serde_json::from_str(&self.read_to_string()).unwrap() } -- cgit v1.2.3