gdDocumentation0.8.0

API reference

GDGzipWriter

Incremental gzip output to files, connections, or HTTP response Writers. write returns the accepted input-byte count; flush publishes buffered output; close completes the member; reset discards state and clears errors. Operations are ordered; failures remain sticky until reset. Methods suspend only the calling routine, with explicit _async variants for signals.

Properties

header : Dictionary

Methods

set_header

set_header(header: Dictionary) -> void

Set metadata for the next unstarted member.

Parameters

NameTypeDefaultDescription
headerDictionaryRequiredCompression metadata configured before the member starts: name, comment, extra, mod_time and os.

Return value

void

No value is returned.

Errors

This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.

write

write(data: PackedByteArray) -> int, Err

Compress bytes and return the accepted input count.

Parameters

NameTypeDefaultDescription
dataPackedByteArrayRequiredInput data in the representation shown by the parameter type.

Return value

int, Err

Suspends only the calling routine until the operation completes. No explicit await is needed.

Errors

The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.

write_async

write_async(data: PackedByteArray) -> await int, Err

Compress bytes and return the accepted input count.

Parameters

NameTypeDefaultDescription
dataPackedByteArrayRequiredInput data in the representation shown by the parameter type.

Return value

await int, Err

Returns a Signal. Use await to receive the completion value shown in the signature.

Errors

The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.

flush

flush() -> Variant, Err

Flush compressed output without ending the member.

Parameters

No parameters.

Return value

Variant, Err

Suspends only the calling routine until the operation completes. No explicit await is needed.

Errors

The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.

flush_async

flush_async() -> await Variant, Err

Flush compressed output without ending the member.

Parameters

No parameters.

Return value

await Variant, Err

Returns a Signal. Use await to receive the completion value shown in the signature.

Errors

The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.

close

close() -> Variant, Err

Finish the member without closing the destination.

Parameters

No parameters.

Return value

Variant, Err

Suspends only the calling routine until the operation completes. No explicit await is needed.

Errors

The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.

close_async

close_async() -> await Variant, Err

Finish the member without closing the destination.

Parameters

No parameters.

Return value

await Variant, Err

Returns a Signal. Use await to receive the completion value shown in the signature.

Errors

The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.

reset

reset(writer: RefCounted) -> Variant, Err

Discard stream state and reuse the compressor at the same level.

Parameters

NameTypeDefaultDescription
writerRefCountedRequiredByte destination exposing a write operation.

Return value

Variant, Err

Suspends only the calling routine until the operation completes. No explicit await is needed.

Errors

The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.

reset_async

reset_async(writer: RefCounted) -> await Variant, Err

Discard stream state and reuse the compressor at the same level.

Parameters

NameTypeDefaultDescription
writerRefCountedRequiredByte destination exposing a write operation.

Return value

await Variant, Err

Returns a Signal. Use await to receive the completion value shown in the signature.

Errors

The result carries a value and an Err. Check the error before using the value; a failure may retain partial progress. In a function returning value, Err, use ? to propagate failure to the caller. The ! operator terminates the program on failure; in serve it fails the current handler.