Skip to content

Commit

Permalink
Add concurrency parameter to file upload and update wasm to .net9
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm360 committed Jul 28, 2024
1 parent 17f6eb7 commit b4c978d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/BeeNet.Core/BeeNet.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Nethereum.Util" Version="4.21.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <!-- Not required, but remove vulnerability warnings -->
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/BeeNet.Util.Wasm/BeeNet.Util.Wasm.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.WebAssembly">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RootNamespace>Etherna.BeeNet.Wasm</RootNamespace>

Expand Down
7 changes: 5 additions & 2 deletions src/BeeNet.Util.Wasm/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,24 @@
[SuppressMessage("Design", "CA1052:Static holder types should be Static or NotInheritable")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("Design", "CA1050:Declare types in namespaces")]
[SuppressMessage("Maintainability", "CA1515:Consider making public types internal")]
public partial class BeeNetWasmUtil
{
[JSExport]
internal static async Task<string> GetHashStringAsync(
byte[] data,
string fileContentType,
string fileName,
int compactLevel)
int compactLevel,
int concurrency)
{
var calculatorService = new CalculatorService();
var result = await calculatorService.EvaluateFileUploadAsync(
data,
fileContentType,
fileName,
compactLevel: (ushort)compactLevel).ConfigureAwait(false);
compactLevel: (ushort)compactLevel,
chunkCuncorrency: concurrency).ConfigureAwait(false);
return result.Hash.ToString();
}
}
3 changes: 2 additions & 1 deletion src/BeeNet.Util.Wasm/wwwroot/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const hash = await exports.BeeNetWasmUtil.GetHashStringAsync(
array,
"text/plain",
"hello.txt",
10
10, //compact level
4 //concurrency
);
console.log(hash);

Expand Down

0 comments on commit b4c978d

Please sign in to comment.