View source code
Display the source code in std/net/curl.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Function std.net.curl.byChunk

HTTP/FTP fetch content as a range of chunks.

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

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.

Example

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

Parameters

NameDescription
url The url to receive content from
chunkSize The size of each chunk
conn The connection to use e.g. HTTP or FTP.

Returns

A range of ubyte[chunkSize] with the content of the resource pointer to by the URL

Authors

Jonas Drewsen. Some of the SMTP code contributed by Jimmy Cao.

License

Boost License 1.0.