Skip to content

Latest commit

 

History

History
59 lines (37 loc) · 1.42 KB

File metadata and controls

59 lines (37 loc) · 1.42 KB

IPFS Extension Overview

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.

Importing extension into cargo project

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"] }

Starting Extension

	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(); 

Testing IPFS Extension

Upload Content

	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();

Download Content

	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));