Installing IPFS Desktop Installing IPFS CLI Recommended
Note: IPFS is required to be installed and running on your machine to use this extension at this time.
In your cargo project add the following
[dependencies]
warp = { git = "https://github.com/Satellite-im/Warp" }
warp-extensions = { git = "https://github.com/Satellite-im/Warp", features = ["fs_ipfs"] }
use warp::constellation::Constellation;
use warp_extensions::fs_ipfs::IpfsFileSystem;
let mut system = IpfsFileSystem::new();
If you have a custom URL to ipfs API server you can do the following
let mut system = IpfsFileSystem::new_with_uri("https://127.0.0.1:5001").unwrap();
use warp::constellation::Constellation;
use warp_extensions::fs_ipfs::IpfsFileSystem;
let mut system = IpfsFileSystem::new();
system.put_buffer("new_file", &b"This is content to the file".to_vec()).await.unwrap();
use warp::constellation::Constellation;
use warp_extensions::fs_ipfs::IpfsFileSystem;
let mut system = IpfsFileSystem::new();
let buffer = system.get_buffer("new_file").await.unwrap();
println!("{}", String::from_utf8_lossy(&buffer));