Coder Social home page Coder Social logo

kristofferstrube / blazor.filesystem Goto Github PK

View Code? Open in Web Editor NEW
27.0 27.0 3.0 14.74 MB

A Blazor wrapper for the File System browser API.

Home Page: https://kristofferstrube.github.io/Blazor.FileSystem/

License: MIT License

C# 98.73% JavaScript 1.27%
blazor blazor-jsinterop blazor-webassembly csharp editor file-system file-system-api filesystem filesystemapi github-pages jsinterop wasm webassembly wrapper

blazor.filesystem's Introduction

Kristoffer Strube

I'm currently working on using Blazor Web Apps to work with the browser easily and safely.

Right now, I'm focusing on wrapping the Web Audio API and its surrounding API's in my Blazor.WebAudio and Blazor.MediaCaptureStreams projects.

My Blog: https://kristoffer-strube.dk

I also do consultancy primarily focused on Blazor. If you are interested in my services, just contact me on Twitter or LinkedIn. Jobs related to my open-source projects get a considerable rebate.

Contact

Twitter ๐Ÿค: @KStrubeG

LinkedIn ๐Ÿ‘”: KristofferStrube

Mastodon ๐Ÿ˜: @KristofferStrube

BlueSky ๐Ÿฆ‹: @kstrubeg.bsky.social

blazor.filesystem's People

Contributors

kristofferstrube avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

blazor.filesystem's Issues

Casting between `FileSystemHandleInProcess` and `FileSystemFileHandleInProcess` or `FileSystemDirectoryHandleInProcess` is not possible.

When we get all the entries of a directory using the ValuesAsync method of FileSystemDirectoryHandleInProcess it currently returns an array of FileSystemHandleInProcess. As the current inheritance hierarchy is we can't cast each entry to either a FileSystemFileHandleInProcess or a FileSystemDirectoryHandleInProcess as they don't inherit from it.
The following is our current inheritance tree:

  graph LR;
  subgraph Blazor Server Supported
    FileSystemHandle
    FileSystemFileHandle
    FileSystemDirectoryHandle
  end
  subgraph Blazor WebAssembly Only
    FileSystemHandleInProcess
    FileSystemFileHandleInProcess
    FileSystemDirectoryHandleInProcess
  end
  FileSystemFileHandle--->FileSystemHandle
  FileSystemDirectoryHandle--->FileSystemHandle
  FileSystemHandleInProcess--->FileSystemHandle
  FileSystemFileHandleInProcess--->FileSystemFileHandle
  FileSystemDirectoryHandleInProcess--->FileSystemDirectoryHandle
Loading

We would ideally have FileSystemDirectoryHandleInProcess inherit from both FileSystemDirectoryHandle and FileSystemHandleInProcess and the same should apply to the file handle.

A solution to this is to use interfaces. If we add two interfaces then the desired cast should be possible, but we will need to change what is returned for a few methods.

  graph LR;
  subgraph Blazor Server Supported
    FileSystemHandle
    FileSystemFileHandle
    FileSystemDirectoryHandle
    IFileSystemHandle
  end
  subgraph Blazor WebAssembly Only
    FileSystemHandleInProcess
    FileSystemFileHandleInProcess
    FileSystemDirectoryHandleInProcess
    IFileSystemHandleInProcess
  end
  FileSystemFileHandle--->FileSystemHandle
  FileSystemDirectoryHandle--->FileSystemHandle
  FileSystemHandleInProcess--->FileSystemHandle
  FileSystemFileHandleInProcess--->FileSystemFileHandle
  FileSystemDirectoryHandleInProcess--->FileSystemDirectoryHandle
  FileSystemHandle-.->IFileSystemHandle
  IFileSystemHandleInProcess-.->IFileSystemHandle
  FileSystemHandleInProcess-.->IFileSystemHandleInProcess
  FileSystemFileHandleInProcess-.->IFileSystemHandleInProcess
  FileSystemDirectoryHandleInProcess-.->IFileSystemHandleInProcess
Loading

Renaming a directory or file "How To"?

With this library I have done all needed operations, now if I change the name of an Entry (a directory or file), how do I persist the change?

I guess that holding to the info, removing and creating a new one will do the job, but is there is any option within the library can you point me to it?

Deserialization of interface types is not supported. Type 'Microsoft.JSInterop.IJSInProcessObjectReferece'. (using .NET 8)

First... This is well put together and useful, great job!

The deserialization (not supported) for the specified type I got running your code under a .NET 8.0 version in a Blazor app within an Aspire project. I stop right there and returned back to your provided sample code "KristofferStrube.Blazor.FileSystem.WasmExample" (WE) just changing the "Target framework" to .NET 8.0. Before this I compiled the "KristofferStrube.Blazor.FileSystem" (FS) just changing the "Target framework" to .NET 8.0. The example project just hangs there (I guess it got some unhandled exception). Then I:

  • Changed WE to .NET 7, kept FS in .NET 8... IT WORKS.
  • Tested WE in .NET 8, FS in .NET 8... just hangs there for eternity.

My next step could be try to figure out what is happening but first I like to see if you can provide a quick answer to this issue.

Hope to hear from anyone soon...

WriteBlobWriteParams could not be found (even doe the js was loaded)

I was trying to adjust the WriteAsync functions a little (adding a write for a DotNetStreamReference) and stumbled over the fact, that my method added to the js file wasn't found. Same goes for the existing version using "WriteBlobWriteParams".

Am I doing something wrong? Was it tested, cause there is no example using the above.
Could it reference a different IJSObjectReference?

The file is loaded as of what I see in the Devtools sources tab, but I receive an error msg:

Microsoft.JSInterop.JSException: Could not find 'WriteBlobWriteParams' ('WriteBlobWriteParams' was undefined).
blazor.webassembly.js:1 Error: Could not find 'WriteBlobWriteParams' ('WriteBlobWriteParams' was undefined).

Thanks for your reply

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.