Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass result of Julia `download` to memory instead of file?

Tags:

http

julia

With Julia 1.6's download function, the typical behavior is to output to a file. How can I save the result directly to something in memory?

E.g. I'd like something like:

result = download(url)
contains(result,"hello")
like image 246
Alec Avatar asked Aug 30 '25 17:08

Alec


1 Answers

As suggested by the help text for download, use the Downloads library; download can take an IOBuffer. Example:

result = String(take!(Downloads.download(url,IOBuffer())))
like image 106
Alec Avatar answered Sep 02 '25 12:09

Alec