{"id":26280075,"url":"https://github.com/kristofferstrube/blazor.compressionstreams","last_synced_at":"2025-05-07T03:04:26.525Z","repository":{"id":239772390,"uuid":"613628969","full_name":"KristofferStrube/Blazor.CompressionStreams","owner":"KristofferStrube","description":"A Blazor wrapper for the Compression Streams browser API.","archived":false,"fork":false,"pushed_at":"2024-08-04T09:54:04.000Z","size":9014,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-07T03:04:18.875Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KristofferStrube.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-14T00:23:52.000Z","updated_at":"2024-08-04T09:54:07.000Z","dependencies_parsed_at":"2024-05-14T15:21:44.228Z","dependency_job_id":"2611f104-b3b6-4dee-8051-b1dd5364be94","html_url":"https://github.com/KristofferStrube/Blazor.CompressionStreams","commit_stats":null,"previous_names":["kristofferstrube/blazor.compressionstreams"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KristofferStrube%2FBlazor.CompressionStreams","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KristofferStrube%2FBlazor.CompressionStreams/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KristofferStrube%2FBlazor.CompressionStreams/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KristofferStrube%2FBlazor.CompressionStreams/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KristofferStrube","download_url":"https://codeload.github.com/KristofferStrube/Blazor.CompressionStreams/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252804206,"owners_count":21806769,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-14T14:18:32.847Z","updated_at":"2025-05-07T03:04:26.505Z","avatar_url":"https://github.com/KristofferStrube.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](/LICENSE.md)\n[![GitHub issues](https://img.shields.io/github/issues/KristofferStrube/Blazor.CompressionStreams)](https://github.com/KristofferStrube/Blazor.CompressionStreams/issues)\n[![GitHub forks](https://img.shields.io/github/forks/KristofferStrube/Blazor.CompressionStreams)](https://github.com/KristofferStrube/Blazor.CompressionStreams/network/members)\n[![GitHub stars](https://img.shields.io/github/stars/KristofferStrube/Blazor.CompressionStreams)](https://github.com/KristofferStrube/Blazor.CompressionStreams/stargazers)\n\n[![NuGet Downloads (official NuGet)](https://img.shields.io/nuget/dt/KristofferStrube.Blazor.CompressionStreams?label=NuGet%20Downloads)](https://www.nuget.org/packages/KristofferStrube.Blazor.CompressionStreams/)\n\n# Introduction\nA Blazor wrapper for the browser API [Compression Streams](https://wicg.github.io/compression/)\n\nThe API defines way to compress and decompress streams of binary data. This project implements a wrapper around the API for Blazor so that we can easily and safely compress and decompress streams.\n\n# Demo\nThe sample project can be demoed at https://kristofferstrube.github.io/Blazor.CompressionStreams/\n\nOn each page you can find the corresponding code for the example in the top right corner.\n\nOn the [API Coverage Status page](https://kristofferstrube.github.io/Blazor.CompressionStreams/Status) you can see how much of the WebIDL specs this wrapper has covered.\n\n# Getting Started\nThe package can be used in Blazor projects.\n## Prerequisites\nYou need to install .NET 7.0 or newer to use the library.\n\n[Download .NET 7](https://dotnet.microsoft.com/download/dotnet/7.0)\n\n## Installation\nYou can install the package via Nuget with the Package Manager in your IDE or alternatively using the command line:\n```bash\ndotnet add package KristofferStrube.Blazor.CompressionStreams\n```\n\n## Import\nYou need to reference the package in order to use it in your pages. This can be done in `_Import.razor` by adding the following.\n```razor\n@using KristofferStrube.Blazor.CompressionStreams\n```\n## Creating wrapper instance\nYou can create wrapper instances for `CompressionStream` and `DecompressionStream` with the two following sets of constructors which either take a format or a reference to an existing JS CompressionStream.\n```csharp\n// Compression Stream constructions\nvar newCompressionStream = await CompressionStream.CreateAsync(JSRuntime, CompressionAlgorithm.Deflate);\n\nIJSObjectReference jSCompressionStream;\nvar existingCompressionStream = await CompressionStream.CreateAsync(JSRuntime, jSCompressionStream);\n\n// Decompression Stream constructions\nvar newDecompressionStream = await DecompressionStream.CreateAsync(JSRuntime, CompressionAlgorithm.Deflate);\n\nIJSObjectReference jSDecompressionStream;\nvar existingDecompressionStream = await DecompressionStream.CreateAsync(JSRuntime, jSDecompressionStream);\n```\n## Using `CompressionStream` and `DecompressionStream`\nThe primary usage of the `CompressionStream`s and `DecompressionStream`s are in combination with the [Blazor.Streams](https://github.com/KristofferStrube/Blazor.Streams) library where the `ReadableStream` can be piped through any stream that implements the `IGenericTransformStream` interface which both `CompressionStream` and `DecompressionStream` does.\n\n```csharp\nReadableStream readableStream;\n\nReadableStream compressed = await readableStream.PipeThroughAsync(newCompressionStream);\n\nReadableStream decompressed = await compressed.PipeThroughAsync(newDecompressionStream);\n```\n\nThis can be useful if you have limited bandwidth and want to stream some content.\n\n# Issues\nFeel free to open issues on the repository if you find any errors with the package or have wishes for features.\n\n# Related articles\nThis repository was build with inspiration and help from the following series of articles:\n\n- [Wrapping Compression Streams in Blazor](https://kristoffer-strube.dk/post/wrapping-compression-streams-in-blazor/)\n- [Wrapping JavaScript libraries in Blazor WebAssembly/WASM](https://blog.elmah.io/wrapping-javascript-libraries-in-blazor-webassembly-wasm/)\n- [Call anonymous C# functions from JS in Blazor WASM](https://blog.elmah.io/call-anonymous-c-functions-from-js-in-blazor-wasm/)\n- [Using JS Object References in Blazor WASM to wrap JS libraries](https://blog.elmah.io/using-js-object-references-in-blazor-wasm-to-wrap-js-libraries/)\n- [Blazor WASM 404 error and fix for GitHub Pages](https://blog.elmah.io/blazor-wasm-404-error-and-fix-for-github-pages/)\n- [How to fix Blazor WASM base path problems](https://blog.elmah.io/how-to-fix-blazor-wasm-base-path-problems/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkristofferstrube%2Fblazor.compressionstreams","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkristofferstrube%2Fblazor.compressionstreams","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkristofferstrube%2Fblazor.compressionstreams/lists"}