MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / createFallbackDownloader

Method createFallbackDownloader

JUCE/modules/juce_core/network/juce_URL.cpp:113–135  ·  view source on GitHub ↗

==============================================================================

Source from the content-addressed store, hash-verified

111
112//==============================================================================
113std::unique_ptr<URL::DownloadTask> URL::DownloadTask::createFallbackDownloader (const URL& urlToUse,
114 const File& targetFileToUse,
115 const String& extraHeadersToUse,
116 Listener* listenerToUse,
117 bool usePostRequest)
118{
119 const size_t bufferSize = 0x8000;
120 targetFileToUse.deleteFile();
121
122 if (auto outputStream = targetFileToUse.createOutputStream (bufferSize))
123 {
124 auto stream = std::make_unique<WebInputStream> (urlToUse, usePostRequest);
125 stream->withExtraHeaders (extraHeadersToUse);
126
127 if (stream->connect (nullptr))
128 return std::make_unique<FallbackDownloadTask> (std::move (outputStream),
129 bufferSize,
130 std::move (stream),
131 listenerToUse);
132 }
133
134 return nullptr;
135}
136
137URL::DownloadTask::DownloadTask() {}
138URL::DownloadTask::~DownloadTask() {}

Callers

nothing calls this directly

Calls 5

moveFunction · 0.85
deleteFileMethod · 0.45
createOutputStreamMethod · 0.45
withExtraHeadersMethod · 0.45
connectMethod · 0.45

Tested by

no test coverage detected