MCPcopy Create free account
hub / github.com/aeroxy/chrome-devtools-cli / save_output

Method save_output

src/result.rs:63–71  ·  view source on GitHub ↗

Write output to a file and return a result with a confirmation message, or return self unchanged if no output path is given. This is a shared helper to avoid duplicating the write-to-file pattern across evaluate, navigate, snapshot, and screenshot commands.

(self, path: Option<&str>)

Source from the content-addressed store, hash-verified

61 /// This is a shared helper to avoid duplicating the write-to-file pattern
62 /// across evaluate, navigate, snapshot, and screenshot commands.
63 pub async fn save_output(self, path: Option<&str>) -> Result<Self, std::io::Error> {
64 match path {
65 Some(p) => {
66 fs::write(p, &self.output).await?;
67 Ok(CommandResult::output(format!("Output saved to {p}")))
68 }
69 None => Ok(self),
70 }
71 }
72}

Callers 7

read_pageFunction · 0.80
take_snapshotFunction · 0.80
navigateFunction · 0.80
go_backFunction · 0.80
go_forwardFunction · 0.80
do_reloadFunction · 0.80
evaluateFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected