{"id":20274883,"url":"https://github.com/jeremy-ellis-tech/net-ipfs-http-client","last_synced_at":"2025-04-11T05:23:43.994Z","repository":{"id":88895627,"uuid":"51443677","full_name":"jeremy-ellis-tech/net-ipfs-http-client","owner":"jeremy-ellis-tech","description":".NET API client for the InterPlanetary File System (IPFS)","archived":false,"fork":false,"pushed_at":"2017-10-31T09:18:13.000Z","size":144,"stargazers_count":77,"open_issues_count":3,"forks_count":15,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-06T11:49:19.011Z","etag":null,"topics":["api","c-sharp","ipfs","portable-library"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jeremy-ellis-tech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-10T13:47:25.000Z","updated_at":"2025-03-30T00:42:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"fa2b6efb-a141-4397-9bf9-4a1fb786477b","html_url":"https://github.com/jeremy-ellis-tech/net-ipfs-http-client","commit_stats":null,"previous_names":["trekdev/net-ipfs-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremy-ellis-tech%2Fnet-ipfs-http-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremy-ellis-tech%2Fnet-ipfs-http-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremy-ellis-tech%2Fnet-ipfs-http-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremy-ellis-tech%2Fnet-ipfs-http-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jeremy-ellis-tech","download_url":"https://codeload.github.com/jeremy-ellis-tech/net-ipfs-http-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248346491,"owners_count":21088463,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","c-sharp","ipfs","portable-library"],"created_at":"2024-11-14T13:06:42.170Z","updated_at":"2025-04-11T05:23:43.982Z","avatar_url":"https://github.com/jeremy-ellis-tech.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# net-ipfs-api v0.4.10\n\n\u003e ![](https://ipfs.io/ipfs/QmQJ68PFMDdAsgCZvA1UVzzn18asVcf7HVvCDgpjiSCAse)\n\n\u003e The .NET portable class library (PCL) for the InterPlanetary File System (IPFS) API.\n\nThis library should be easy to use if you're familiar with the IPFS CLI. Top level commands (eg. `ipfs cat`, `ipfs add`) are methods in `IpfsClient`. Subcommands are methods in the IPFS client's properties named after the subcommands.\n\nie. `ipfs swarm peers` becomes `ipfs.Swarm.Peers()` and `ipfs add \u003cfile\u003e` becomes `ipfs.Add(file)`. Easy!\n\nThe only exception is if a valid 'top level' command has subcommands, since C# can't have methods and properties with the same name. ie. `ipfs config` and `ipfs config edit` become `ipfs.ConfigCommand()` and `ipfs.Config.Edit()`.\n\nCLI arguments are required method parameters and CLI options are optional method parameters.\n\n## NuGet\nThis library is available on [NuGet](https://www.nuget.org/packages/net-ipfs-api).\n\nYou can install it with the NuGet package manager:\n\n    PM\u003e Install-Package net-ipfs-api\n    \n\n## Examples\n\n### Adding \u0026 reading a file:\n\n    using (var ipfs = new IpfsClient())\n    {\n      //Name of the file to add\n      string fileName = \"test.txt\";\n\n      //Wrap our stream in an IpfsStream, so it has a file name.\n      IpfsStream inputStream = new IpfsStream(fileName, File.OpenRead(fileName));\n\n      MerkleNode node = await ipfs.Add(inputStream);\n\n      Stream outputStream = await ipfs.Cat(node.Hash);\n\n      using(StreamReader sr = new StreamReader(outputStream))\n      {\n        string contents = sr.ReadToEnd();\n\n        Console.WriteLine(contents); //Contents of test.txt are printed here!\n      }\n    }\n\n\n### Disconnect from all peers:\n    using (var ipfs = new IpfsClient())\n    {\n        var peers = await ipfs.Swarm.Peers();\n        await ipfs.Swarm.Disconnect(peers);\n    }\n    \n### Cancellation support\n\n    try\n    {\n        var cts = new CancellationTokenSource(1000);\n        \n        using (var httpClient = new HttpClient() { Timeout = Timeout.InfiniteTimeSpan })\n        using (var ipfsClient = new IpfsClient(new Uri(\"http://127.0.0.1:5001\"), httpClient))\n        {\n            //The CancellationTokenSource will cancel the task after 1 second\n            //Simulate a 2 second delay for this example to ensure the task gets cancelled\n            await Task.Delay(2000);\n            var result = await ipfsClient.Cat(\"QmPb8TjUbiRm1M9pvz8QW14PfBjkQyRitnJCZ95oRTRYBt\", cts.Token);\n        }\n    }\n    catch (TaskCanceledException)\n    {\n        Console.WriteLine(\"The request was canceled\");                \n    }\n\n## License\nMIT license, see LICENSE for details\n\n## Thanks\nThanks to [@slothbag](https://github.com/slothbag) \u0026 [@timothyparez](https://github.com/timothyparez)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeremy-ellis-tech%2Fnet-ipfs-http-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeremy-ellis-tech%2Fnet-ipfs-http-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeremy-ellis-tech%2Fnet-ipfs-http-client/lists"}