Asynchronous I/O
All requests to the IPFS engine are asynchronous, which does not block current thread.
This means that callers should normally use the async/await
paradigm
async Task<Cid> AddText()
{
var data = await ipfs.FileSystem.AddTextAsync("I am pinned");
return data.Id;
}
If a synchronous operation is required, then this can work
Cid AddText()
{
var data = ipfs.FileSystem.AddTextAsync("I am pinned").Result;
return data.Id;
}
Or use .Wait()
instead of .Result
when the operation returns nothing.