Skip to content

Instantly share code, notes, and snippets.

View Matheos96's full-sized avatar

Matheos Mattsson Matheos96

View GitHub Profile
@Matheos96
Matheos96 / BlazorWasmHttpClientStreamingExtension.cs
Created April 6, 2025 08:22
Simple extension method that performs a get request to the given endpoint and returns an IAsyncEnumerable<T?> which emits a value every time the server streams a new value
namespace blazorwasm;
using System.Net.Http.Json;
using System.Runtime.CompilerServices;
using Microsoft.AspNetCore.Components.WebAssembly.Http;
public static class Extensions
{
public static IAsyncEnumerable<T?> GetFromJsonAsAsyncEnumerableUsingStreaming<T>(
this HttpClient client, string? uri, CancellationToken ct = default)
@Matheos96
Matheos96 / ExtractTarGz.cs
Last active February 3, 2023 11:11 — forked from ForeverZer0/ExtractTarGz.cs
Use pure C# to extract .tar and .tar.gz files
namespace TarExtractor;
using System.IO.Compression;
using System.Text;
public class Tar
{
/// <summary>
/// Extracts a <i>.tar.gz</i> archive to the specified directory.
/// </summary>