CompressionService

Wraps the Compression Streams API for gzip/deflate compression and decompression of Uint8Array data. Useful for reducing transfer sizes or storing compressed data locally.

TypeScriptexample.ts
import { CompressionService } from '@angular-helpers/browser-web-apis'

# Methods

MethodSignatureReturnsDescription
isSupportedisSupported(): booleanbooleanPublic method isSupported.
compresscompress(data: Uint8Array | ArrayBuffer, format: CompressionFormat): Promise<Uint8Array>Promise<Uint8Array>Compress a `Uint8Array`/`ArrayBuffer` using the given format.
decompressdecompress(data: Uint8Array | ArrayBuffer, format: CompressionFormat): Promise<Uint8Array>Promise<Uint8Array>Decompress a `Uint8Array`/`ArrayBuffer` using the given format.
compressStringcompressString(value: string, format: CompressionFormat): Promise<Uint8Array>Promise<Uint8Array>Convenience: compress a UTF-8 string and return the compressed bytes.
decompressStringdecompressString(data: Uint8Array | ArrayBuffer, format: CompressionFormat): Promise<string>Promise<string>Convenience: decompress bytes into a UTF-8 string.
LCP N/A
CLS N/A
INP N/A