C
C#5mo ago
Lexan

Download audio file from blob

Hello! I'm trying to download an audio file from an open unsecured blob with a URL that starts with blob:https. I'm working on an ASP.NET Core app, .net 7, and Windows both locally and on the host in Azure. WebClient can't handle the blob prefix. Does anyone have another approach to how to download the file or get the stream?
4 Replies
Angius
Angius5mo ago
WebClient is deprecated btw, it shouldn't be used for anything, not just file download Try HttpClient If it's a stream, then something like
using var ms = new MemoryStream();
using var client = new HttpClient();

var res = await client.GetStreamAsync(url);
res.CopyTo(ms);
using var ms = new MemoryStream();
using var client = new HttpClient();

var res = await client.GetStreamAsync(url);
res.CopyTo(ms);
should do
Lexan
Lexan5mo ago
I see. That is very good info. I should look at updating the code then. However, it is the same problem with HttpClient. I saying that the 'blob' scheme is not supported. Btw how did you get the code to look like that in discord?
SinFluxx
SinFluxx5mo ago
$codegif
Want results from more Discord servers?
Add your server
More Posts
Razor MVC UI reuseI cant believe that I cannot figure this out, but how do I create the equivalent of a react or blazodoes this work for choosing a random item in a list then removing it then choosing again```int randomNumber = Random.Range(spawnInts[0], spawnInts.Count); spawnInts.Rem✅ MySQL with Entity Framework, getting null of entity all time```cs public class UserAssignmentDate { [ForeignKey("UserId")] public int UserId { get; set;Looking to not include the ground in my racing game to collide and trigger the event for FMODI have some code I am using to trigger as sound when colliding with objects in my racing game I am w✅ How to do the C# equivalent of passing an std::function into a classHi, so I'm trying to make a class function that can accept a function of type float(float). I don't MudBlazor Generic Server Side Table IssuesHello all, I am attempting to make a more "generic" MudTable on Blazor Server, as I use them frequen.NET Core & React | AuthenticationSo I want to create a new webapp with React and .NET Core. I created a new project in Visual Studio Clean architecture and EF entities as domain modelsHi! I have an architecture inspired mostly by Ardalis's Clean Architecture. It comprises 3 (theoreti✅ Aspire .NET deploy into k8sHello, I am looking for deployment an Aspire application into k8s cluster. Anybody already had exper✅ A* Algorithm Get Node where x and y is 1 less (Neigbour)Any idea how to get the neighbours? ive tried to grab the neighbour pathnode item by subtracting 1 f