Skip to content

[#61826] Add blob() method to DotNetStreamReference#66679

Open
andersabjorn wants to merge 3 commits into
dotnet:mainfrom
andersabjorn:feature/add-blob-method-dotnetstream
Open

[#61826] Add blob() method to DotNetStreamReference#66679
andersabjorn wants to merge 3 commits into
dotnet:mainfrom
andersabjorn:feature/add-blob-method-dotnetstream

Conversation

@andersabjorn
Copy link
Copy Markdown

Add blob() method to DotNetStreamReference

Description

This PR implements the blob() method for DotNetStreamReference as requested in issue #61826.

Changes Made:

  • Add async blob(mimeType?: string): Promise<Blob> method to DotNetStream class in Microsoft.JSInterop.ts
  • Update JavaScript interop tests in jsinteroptests.js to validate blob functionality
  • Method allows optional MIME type parameter for content-type headers
  • Follows the same pattern as existing arrayBuffer() method

Usage Example:

// Get stream data as a Blob
const blob = await dotNetStreamRef.blob('application/pdf');

// Create download link
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'document.pdf';
a.click();

// Display image
const img = document.createElement('img');
img.src = URL.createObjectURL(blob);

Fixes #61826

- Add async blob() method to DotNetStream class in Microsoft.JSInterop.ts
- Update JavaScript interop tests to validate blob functionality
- Method allows optional MIME type parameter for content-type headers

Fixes dotnet#61826
@andersabjorn andersabjorn requested a review from a team as a code owner May 14, 2026 07:53
@github-actions github-actions Bot added the area-blazor Includes: Blazor, Razor Components label May 14, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label May 14, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Thanks for your PR, @andersabjorn. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@andersabjorn
Copy link
Copy Markdown
Author

@dotnet-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Design proposal: #47685 Add blob() method to JS side of Blazor DotNetStreamReference

1 participant