pub fn ipfs(
    uri: &str,
) -> Result<(
    impl Sink<String, Error = Error>,
    impl Stream<Item = Result<Vec<u8>>>,
)> {
    let client = IpfsClient::from_str(uri).expect("unvalid uri");
    let mut runtime = tokio::runtime::Runtime::new().expect("unable to start runtime");

    let (sender, receiver) = mpsc::unbounded();
    let datas = receiver.map(move |msg: String| {
        runtime
            .block_on(client.cat(msg.as_str()).map_ok(|c| c.to_vec()).try_concat())
            .map_err(|e| e.to_string().into())
    });
    Ok((sender.sink_err_into(), datas))
}
/// Download some data from IPFS network.
///
/// Returns IPFS data objects.
Download some data from IPFS network.
Returns IPFS data objects.
Download some data from IPFS network . Returns IPFS data objects .
pub fn ipfs(
    uri: &str,
) -> Result<(
    impl Sink<String, Error = Error>,
    impl Stream<Item = Result<Vec<u8>>>,
)> {
    let client = IpfsClient::from_str(uri).expect("unvalid uri");
    let mut runtime = tokio::runtime::Runtime::new().expect("unable to start runtime");
    let (sender, receiver) = mpsc::unbounded();
    let datas = receiver.map(move |msg: String| {
        runtime
            .block_on(client.cat(msg.as_str()).map_ok(|c| c.to_vec()).try_concat())
            .map_err(|e| e.to_string().into())
    });
    Ok((sender.sink_err_into(), datas))
}
pub fn ipfs ( uri : & str , ) -> Result < ( impl Sink < String , Error = Error > , impl Stream < Item = Result < Vec < u8 > > > , ) > { let client = IpfsClient :: from_str ( uri ) . expect ( " " ) ; let mut runtime = tokio :: runtime :: Runtime :: new ( ) . expect ( " " ) ; let ( sender , receiver ) = mpsc :: unbounded ( ) ; let datas = receiver . map ( move | msg : String | { runtime . block_on ( client . cat ( msg . as_str ( ) ) . map_ok ( | c | c . to_vec ( ) ) . try_concat ( ) ) . map_err ( | e | e . to_string ( ) . into ( ) ) } ) ; Ok ( ( sender . sink_err_into ( ) , datas ) ) }
Download some data from IPFS network.
Download some data from IPFS network .
uri
&str