vibe.d beta banner
get vibe.d
0.10.0

Asynchronous I/O that doesn’t get in your way, written in D

Function ChunkedOutputStream.chunkExtensionCallback

A delegate used to specify the extensions for each chunk written to the underlying stream.

@safe string delegate(in ubyte[]) chunkExtensionCallback() @property @safe const;

void chunkExtensionCallback (
  @safe string delegate(in ubyte[]) cb
) @property @safe;

The delegate has to be of type string delegate(in const(ubyte)[] data) and gets handed the data of each chunk before it is written to the underlying stream. If it's return value is non-empty, it will be added to the chunk's header line.

The returned chunk extension string should be of the format key1=value1;key2=value2;[...];keyN=valueN and **not contain any carriage return or newline characters**.

Also note that the delegate should accept the passed data through a scoped argument. Thus, **no references to the provided data should be stored in the delegate**. If the data has to be stored for later use, it needs to be copied first.

Authors

Sönke Ludwig, Jan Krüger

Copyright

© 2012-2015 Sönke Ludwig

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.