http://coldfusion.com logo
#cfml-general
Title
# cfml-general
j

John Wilson

04/19/2022, 7:25 PM
Does anyone know how to do direct-to-disk http downloads in lucee? cfhttp wants to read the entire file into memory before I can save it and I need to grab a 28GB file from an S3 signed url regularly.
b

bdw429s

04/19/2022, 8:11 PM
You can write your own HTTP client to do this
If you look at the progressable downloader in CommandBox, you can get an idea
I write the file to disk and I THINK it doesn't stay in memory-- I'd have to actually test that
But it's basically a matter of looping over an input stream and writing out the bytes as they come in
j

John Wilson

04/19/2022, 8:12 PM
gotcha. I do that on arduinos
b

bdw429s

04/19/2022, 8:12 PM
I'm curious if BoltHTTP does this-- if not, would be a great addition cc @foundeo
CFHTTP really should provide a way to do it too.
j

John Wilson

04/19/2022, 8:12 PM
agreed
f

foundeo

04/19/2022, 8:15 PM
I don’t think BoltHTTP does support it
j

John Wilson

04/19/2022, 11:34 PM
FWIW, this looks like an option, but not sure how to create the URL and File objects - passing strings doesn't work https://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/FileUtils.html#copyURLToFile-java.net.URL-java.io.File-int-int-
e

Evil Ware

04/28/2022, 1:49 AM
You could just use cfexcecute to run rsync, or if it's UNIX and do you absolutely know what you are doing you could use 'dd'
2 Views