2015-04-09 10:12:50 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "types.hh"
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
2015-10-21 12:59:01 +00:00
|
|
|
struct DownloadOptions
|
|
|
|
{
|
|
|
|
string expectedETag;
|
|
|
|
bool verifyTLS{true};
|
|
|
|
};
|
|
|
|
|
2015-04-09 10:12:50 +00:00
|
|
|
struct DownloadResult
|
|
|
|
{
|
|
|
|
bool cached;
|
|
|
|
string data, etag;
|
|
|
|
};
|
|
|
|
|
2015-10-21 12:59:01 +00:00
|
|
|
DownloadResult downloadFile(string url, const DownloadOptions & options);
|
2015-04-09 10:12:50 +00:00
|
|
|
|
2015-05-05 15:09:42 +00:00
|
|
|
Path downloadFileCached(const string & url, bool unpack);
|
|
|
|
|
2015-04-09 10:49:13 +00:00
|
|
|
MakeError(DownloadError, Error)
|
|
|
|
|
2015-05-06 12:54:31 +00:00
|
|
|
bool isUri(const string & s);
|
|
|
|
|
2015-04-09 10:12:50 +00:00
|
|
|
}
|