在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:bchavez/Pinata.Client开源软件地址:https://github.com/bchavez/Pinata.Client开源编程语言:C# 69.8%开源软件介绍:Pinata.Client for .NET/C# LibraryProject DescriptionA .NET implementation for Pinata Cloud. Minimum Requirements
Crypto Tip JarDownload & InstallNuget Package Pinata.Client Install-Package Pinata.Client Getting Startedvar config = new Config
{
ApiKey = "2981f1eb1813daf...",
ApiSecret = "42281fa28de32fe3c..."
};
var client = new PinataClient(config);
var html = @"
<html>
<head>
<title>Hello IPFS!</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
";
var metadata = new PinataMetadata // optional
{
KeyValues =
{
{"Author", "Brian Chavez"}
}
};
var options = new PinataOptions(); // optional
options.CustomPinPolicy.AddOrUpdateRegion("NYC1", desiredReplicationCount: 1);
var response = await this.client.Pinning.PinFileToIpfsAsync(content =>
{
var file = new StringContent(html, Encoding.UTF8, MediaTypeNames.Text.Html);
content.AddPinataFile(file, "index.html");
},
metadata,
options);
if( response.IsSuccess )
{
//File uploaded to Pinata Cloud and can be accessed on IPFS!
var hash = response.IpfsHash; // QmR9HwzakHVr67HFzzgJHoRjwzTTt4wtD6KU4NFe2ArYuj
} Now your file can be accessed over IPFS and accessed via Cloudflare's IPFS gateway!
Find more examples here. Magic! Easy peasy! Happy file sharing! |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论