byChunk

HTTP/FTP fetch content as a range of chunks.

A range of chunks is returned when the request is complete. If the method or other request properties is to be customized then set the conn parameter with a HTTP/FTP instance that has these properties set.

byChunk
(
Conn = AutoProtocol
)
(
const(char)[] url
,
size_t chunkSize = 1024
,
Conn conn = Conn()
)
if (
isCurlConn!(Conn)
)

Parameters

url const(char)[]

The url to receive content from

chunkSize size_t

The size of each chunk

conn Conn

The connection to use e.g. HTTP or FTP.

Return Value

Type: auto

A range of ubytechunkSize with the content of the resource pointer to by the URL

Examples

import std.net.curl, std.stdio;
foreach (chunk; byChunk("dlang.org", 100))
    writeln(chunk); // chunk is ubyte[100]

Meta