You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-12
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ You also need to reference the package in order to use it in your pages. This ca
41
41
Most of this library is wrapper classes which can be instantiated from your code using the static `Create` and `CreateAsync` methods on the wrapper classes.
42
42
An example could be to create an instance of a `Blob` that contains the text `"Hello World!"` and gets its `Size` and `Type`, read it as a `ReadableStream`, read as text directly, and slice it into a new `Blob` like this.
All creator methods take an `IJSRuntime` instance as the first parameter. The above sample will work in both Blazor Server and Blazor WebAssembly. If we only want to work with Blazor WebAssembly we can use the `InProcess` variant of the wrapper class. This is equivalent to the relationship between `IJSRuntime` and `IJSInProcessRuntime`. We can recreate the above sample using the `BlobInProcess` which will simplify some of the methods we can call on the `Blob` and how we access attributes.
Some of the methods wrap a `Promise` so even in the `InProcess` variant we need to await it like we see for `TextAsync` above.
75
75
76
76
If you have an `IJSObjectReference` or an `IJSInProcessObjectReference` for a type equivalent to one of the classes wrapped in this package then you can construct a wrapper for it using another set of overloads of the static `Create` and `CreateAsync` methods on the appropriate class. In the below example we create wrapper instances from existing JS references to a `File` object.
77
77
```csharp
78
78
// Blazor Server compatible.
79
79
IJSObjectReferencejSFile; // JS Reference from other package or your own JSInterop.
The library uses the following other packages to support its features:
131
+
-https://github.com/KristofferStrube/Blazor.Streams (To return a rich `ReadableStream` from the `StreamAsync` method on a `Blob`)
132
+
-https://github.com/KristofferStrube/Blazor.DOM (To implement `FileReader` which extends `EventTarget` and to implement `ProgressEvent` which extends `Event`)
132
133
133
-
This project is used in the *Blazor.FileSystem* package to return a rich `File` object when getting the `File` from a `FileSystemFileHandle` and when writing a `Blob` to a `FileSystemWritableFileSystem`.
The library is used in the following other packages to support their features:
135
+
-https://github.com/KristofferStrube/Blazor.FileSystem (to return a rich `File` object when getting the `File` from a `FileSystemFileHandle` and when writing a `Blob` to a `FileSystemWritableFileSystem`)
136
+
-https://github.com/KristofferStrube/Blazor.MediaStreamRecording (to get the data from a `BlobEvent` which is created when a chunk of a stream has been recorded)
135
137
136
138
# Related articles
137
139
This repository was build with inspiration and help from the following series of articles:
0 commit comments