MCPcopy Create free account
hub / github.com/MultiFuzz/MultiFuzz / from_path

Method from_path

hail-fuzz/src/input.rs:139–151  ·  view source on GitHub ↗
(path: &std::path::Path)

Source from the content-addressed store, hash-verified

137 }
138
139 pub fn from_path(path: &std::path::Path) -> anyhow::Result<Self> {
140 let buf =
141 std::fs::read(path).with_context(|| format!("error reading: {}", path.display()))?;
142
143 // Try parsing using the latest format.
144 if let Some(data) = Self::from_bytes(&buf) {
145 return Ok(data);
146 }
147 // Fallback to legacy format.
148 legacy::multi_stream_from_bytes_v0(&buf).ok_or_else(|| {
149 anyhow::format_err!("error parsing {} as multistream data", path.display())
150 })
151 }
152
153 pub fn to_bytes(&self) -> Vec<u8> {
154 let mut headers: Vec<_> = self

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected