library(zlib)
, using a Prolog stream
as a filter on another stream. Options:
true
(default false
), the parent stream is closed
if DataStream is closed.set_stream(DataStream, buffer(line))
on the data stream to get line-buffered output. See
set_stream/2 for details. Switching buffering to false
is supported.Here is example code to write a chunked data to a stream
http_chunked_open(Out, S, []), format(S, 'Hello world~n', []), close(S).
If a stream is known to contain chunked data, we can extract this data using
http_chunked_open(In, S, []), read_stream_to_codes(S, Codes), close(S).
The current implementation does not generate chunked extensions or an HTTP trailer. If such extensions appear on the input they are silently ignored. This is compatible with the HTTP 1.1 specifications. Although a filtering stream is an excellent mechanism for encoding and decoding the core chunked protocol, it does not well support out-of-band data.
After http_chunked_open/3, the encoding of DataStream is the
same as the encoding of RawStream, while the encoding of
RawStream is octet
, the only value allowed for HTTP chunked
streams. Closing the DataStream restores the old encoding on
RawStream.
io_error(read, Stream)
where the message context provides
an indication of the problem. This error is raised if
the input is not valid HTTP chunked data.