mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-03-31 17:15:35 +00:00
13 lines
340 B
Rust
13 lines
340 B
Rust
/// Parse infohash from the source filepath,
|
|
/// decode JSON to array on success
|
|
pub fn infohashes(path: &str) -> anyhow::Result<Vec<String>> {
|
|
let mut f = std::fs::File::open(path)?;
|
|
let mut s = String::new();
|
|
|
|
use std::io::Read;
|
|
f.read_to_string(&mut s)?;
|
|
|
|
let r: Vec<String> = serde_json::from_str(&s)?;
|
|
|
|
Ok(r)
|
|
}
|