ThirdwebStorage

The ThirdwebStorage class provides methods to interact with any URL including IPFS, allowing you to download and upload data easily.

Download

Download data from an HTTP or IPFS URI.

var data = await ThirdwebStorage.Download<string>(client, "{{uri}}");

Upload

Upload file to IPFS and pin it.

var result = await ThirdwebStorage.Upload(client, "{{path/to-file}}");

UploadRaw

Upload raw data to IPFS and pin it.

var bytes = Encoding.UTF8.GetBytes("{{data}}");
var result = await ThirdwebStorage.UploadRaw(client, bytes);

Example Usage

Downloading JSON Data

var jsonData = await ThirdwebStorage.Download<Dictionary<string, object>>(client, "ipfs://Qm...");

Uploading a File

var uploadResult = await ThirdwebStorage.Upload(client, @"C:\path\to\your\file.txt");
Console.WriteLine($"IPFS Hash: {uploadResult.IpfsHash}");