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