Tewr / BlazorWorker

Library for creating DotNet Web Worker threads/multithreading in Client side Blazor
MIT License
392 stars 36 forks source link

Worker filesystem access #81

Closed BorisGerretzen closed 11 months ago

BorisGerretzen commented 2 years ago

When I create a directory with DirectoryInfo dirInfo = new("temp"); dirInfo.Create(); in the main thread, the folder does not appear when executing Directory.GetDirectories("/"); when it is run from the worker. When it is executed from the main thread the folder does appear. Is there a way around this?

Tewr commented 2 years ago

Hello, thank you for your question. What you need for this to work is a persistent file system. I can't find any info on this, other than that it used to work with indexeddb once (idbfs), and that they removed it to keep the runtime small: https://github.com/dotnet/runtime/issues/48562

As I understand it, the current implementation is in memory only, and blazerworker has two (or more) separate processes with no memory sharing.

Depends on what you are trying to achieve here, but maybe try implementing IFileProvider interface using indexeddb or some other persistent browser api.