mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-04-01 09:35:37 +00:00
initial commit
This commit is contained in:
parent
9fcd892d42
commit
d55c642eb6
11 changed files with 305 additions and 1 deletions
13
src/api.rs
Normal file
13
src/api.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/// 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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue