Wren a web browser where WebAssembly runs everything, JavaScript included

Module compression

CompressionStream and DecompressionStream (Compression Standard; src/page/compression.odin, the streams themselves: native/js/runtime/web_transform.c): a DEFLATE stream (the toolkit's flate package: gzip, zlib "deflate" or raw) fed chunk by chunk. One call's output is bounded by page.max_fetch_bytes (Quota past it: a decompression bomb errors the stream).

Exposed to: Window, Worker. Source: api/compression.widl.

Odin: import "wren:compression".

Types

handle Compressor : Object

Checked by the browser on every call (lookup_Compressor).

enum CompressionFormat : i32

membervalue
Gzip0
Deflate1
Deflate_Raw2

Functions

Compression_create

Compressor Compression_create(CompressionFormat format, bool decompress) raises

A compressor (decompress false) or a decompressor of format.

Odin: compression.create.

Raises: returns an Error (see web).

Host: Compression_create :: proc(c: ^Call, format: Api_CompressionFormat, decompress: bool) -> (u64, Api_Error)

Compression_push

bytes Compression_push(Compressor compressor, bytes input) raises

Feeds input: the output it made (Compression_output reads it again when the buffer was too small). Type for data that is not of the format, or that follows the end of the compressed data; Quota past the bound.

Odin: compression.push.

Raises: returns an Error (see web).

Has effects: call it once per result (no length query).

Host: Compression_push :: proc(c: ^Call, compressor: Api_Compressor, input: []u8) -> ([]u8, Api_Error)

Compression_finish

bytes Compression_finish(Compressor compressor) raises

The end of the input: what is left of the output. Type when the compressed data ended before its end.

Odin: compression.finish.

Raises: returns an Error (see web).

Has effects: call it once per result (no length query).

Host: Compression_finish :: proc(c: ^Call, compressor: Api_Compressor) -> ([]u8, Api_Error)

Compression_output

bytes Compression_output(Compressor compressor)

The output of the last push or finish.

Odin: compression.output.

Host: Compression_output :: proc(c: ^Call, compressor: Api_Compressor) -> []u8

Edit this page on GitHub