DEV Community

IronSoftware
IronSoftware

Posted on

CurlDotNet is Live on NuGet! Copy-Paste curl Commands πŸš€ Directly into C#

πŸŽ‰ Big News: CurlDotNet v1.0.0 is Now on NuGet!

With full support for C#, F#, VB.NET,.NET 10 and .NET Framework

Hey DEV community! I'm thrilled to announce that CurlDotNet is officially live on NuGet! After months of development and testing, you can now install it with a single command:

dotnet add package CurlDotNet
Enter fullscreen mode Exit fullscreen mode

The Problem We All Face

Picture this: You're building a .NET app and find the perfect API example... but it's a curl command:

curl -X POST https://api.stripe.com/v1/charges \
  -u sk_test_123: \
  -d amount=2000 \
  -d currency=usd \
  -d source=tok_visa
Enter fullscreen mode Exit fullscreen mode

Now you have to:

  1. πŸ€” Figure out the HttpClient equivalent
  2. πŸ“ Rewrite everything in C#
  3. πŸ› Debug the differences
  4. 😀 Waste 30 minutes on something that should take 30 seconds

Enter CurlDotNet: Just Paste and Go!

With CurlDotNet, you literally paste the curl command into your C# code:

using CurlDotNet;

// Just paste it!
var result = await Curl.ExecuteAsync(@"
    curl -X POST https://api.stripe.com/v1/charges \
      -u sk_test_123: \
      -d amount=2000 \
      -d currency=usd \
      -d source=tok_visa
");

Console.WriteLine(result.Body); // Your charge is created!
Enter fullscreen mode Exit fullscreen mode

That's it. No translation. No googling. It just works.

πŸ”₯ Real-World Examples That Just Work

GitHub API

// From GitHub's docs - paste directly!
var result = await Curl.ExecuteAsync(@"
    curl -H 'Accept: application/vnd.github+json' \
         -H 'Authorization: Bearer ghp_YOUR_TOKEN' \
         https://api.github.com/user/repos
");

var repos = JsonSerializer.Deserialize<List<Repo>>(result.Body);
Enter fullscreen mode Exit fullscreen mode

OpenAI API

// From OpenAI docs - no translation needed!
var result = await Curl.ExecuteAsync(@"
    curl https://api.openai.com/v1/chat/completions \
      -H 'Content-Type: application/json' \
      -H 'Authorization: Bearer $OPENAI_API_KEY' \
      -d '{
        ""model"": ""gpt-4"",
        ""messages"": [{""role"": ""user"", ""content"": ""Hello!""}]
      }'
");
Enter fullscreen mode Exit fullscreen mode

File Downloads

// Download with progress - curl style!
var result = await Curl.ExecuteAsync(@"
    curl -L -o output.zip \
         --progress-bar \
         https://github.com/repo/archive/main.zip
");
Enter fullscreen mode Exit fullscreen mode

πŸ› οΈ Three Ways to Use CurlDotNet

1. Command Mode (Paste from docs)

var result = await Curl.ExecuteAsync("curl https://api.example.com");
Enter fullscreen mode Exit fullscreen mode

2. Fluent Builder (Type-safe with IntelliSense)

var result = await Curl.Request("https://api.example.com")
    .WithMethod("POST")
    .WithHeader("Authorization", "Bearer token")
    .WithData("{\"key\":\"value\"}")
    .ExecuteAsync();
Enter fullscreen mode Exit fullscreen mode

3. LibCurl API (Reusable client)

using var curl = new LibCurl();
curl.WithBearerToken("token123")
    .WithTimeout(TimeSpan.FromSeconds(30));

var users = await curl.GetAsync("https://api.example.com/users");
var posts = await curl.GetAsync("https://api.example.com/posts");
Enter fullscreen mode Exit fullscreen mode

🎯 Why CurlDotNet is Different

This is NOT a wrapper around the curl binary. It's a complete reimplementation in pure C#:

  • βœ… No dependencies - Pure .NET, no native binaries
  • βœ… Cross-platform - Windows, Linux, macOS, Docker, everywhere
  • βœ… .NET 10 Ready - Tested on .NET 6, 8, and 10
  • βœ… Universal - .NET Standard 2.0 means it works with Framework, Xamarin, Unity, MAUI
  • βœ… 93% Test Coverage - 223 tests passing
  • βœ… IntelliSense - Full IDE support

πŸ“Š By the Numbers

  • 240 unit tests (223 passing - 93% coverage)
  • 100% curl syntax compatibility for HTTP/HTTPS
  • Zero external dependencies
  • 3 API styles to match your coding preference
  • Supports .NET Standard 2.0+ (Framework 4.7.2 to .NET 10)

πŸš€ What's Next?

CurlDotNet is part of the UserlandDotNet initiative - bringing Linux userland tools to .NET. Coming soon:

  • grep for .NET
  • sed and awk for text processing
  • tar for archives
  • PowerShell cmdlets for everything

πŸ’‘ Try It Now!

  1. Install the package:
dotnet add package CurlDotNet
Enter fullscreen mode Exit fullscreen mode
  1. Paste any curl command:
var result = await Curl.ExecuteAsync("curl https://httpbin.org/json");
Console.WriteLine(result.Body);
Enter fullscreen mode Exit fullscreen mode
  1. That's it! You're using curl in C#!

🀝 Get Involved

CurlDotNet is open source and needs your help!

  • ⭐ Star the repo: github.com/jacob-mellor/curl-dot-net
  • πŸ› Report issues: Found a bug? Let me know!
  • πŸ’» Contribute: PRs welcome for new features
  • πŸ“’ Share: Tell your team about CurlDotNet

πŸ† Special Thanks

Built with passion by Jacob Mellor at IronSoftware, inspired by the .NET community's need for better tools.

Questions?

Drop a comment below! I'm here to help and would love to hear how you're using CurlDotNet.


Install now and stop translating curl commands forever:

dotnet add package CurlDotNet
Enter fullscreen mode Exit fullscreen mode

NuGet: nuget.org/packages/CurlDotNet
GitHub: github.com/jacob-mellor/curl-dot-net

dotnet #csharp #curl #opensource #nuget

Top comments (0)