upload_and_feed/
upload_and_feed.rs1use scout::LiteClient;
8
9#[tokio::main]
10async fn main() -> anyhow::Result<()> {
11 let file = std::env::args().nth(1).expect("usage: upload_and_feed <file>");
12 let node = std::env::var("BEE_NODE").unwrap_or_else(|_| "http://localhost:1633".into());
13 let stamp = std::env::var("BEE_STAMP").expect("set BEE_STAMP to a usable postage batch id");
14
15 let scout = LiteClient::read(&node)?.with_write(&node, &stamp)?;
17
18 let data = std::fs::read(&file)?;
19 let file_ref = scout.up_bytes(data).await?;
20 println!("uploaded: {file_ref}");
21
22 let (key, _owner, _pubkey) = scout::generate_key()?;
24 let handle = scout.publish(&key, "example-feed", &file_ref).await?;
25 println!("feed handle: {handle}");
26 println!("read latest: scout cat {handle} --gateway {node}");
27 Ok(())
28}