Handbook
Glossary
download-to-temporary-file ( obj -- path )
HTTP Download Utilities
Prev:
download-outdated-as ( url path duration -- path' )
Next:
download-name ( url -- name )
Vocabulary
http
.
download
Inputs
obj
an
object
Outputs
path
a pathname string
Word description
Downloads a url to a unique temporary file in
current-directory
named
temp.XXXXXXXXXreal-file-name.ext.temp
.
Definition
IN:
http.download
GENERIC:
download-to-temporary-file
( obj -- path )
Methods
USING:
accessors
http
http.download
;
M:
request
download-to-temporary-file
url>>
download-to-temporary-file
;
USING:
http.download
strings
urls
;
M:
string
download-to-temporary-file
>url
download-to-temporary-file
;
USING:
accessors
http.download
http.download.private
io.directories
io.encodings.binary
io.files.unique
kernel
mime.types
sequences
splitting
urls
;
M:
url
download-to-temporary-file
[
download-temporary-name
binary
]
keep
[
http-write-request
]
curry
with-unique-file-writer
swap
[
dup
".temp"
?tail
drop
]
[
content-type>>
mime-type>extension
"temp"
or
"."
glue
find-next-incremented-name
]
bi*
[
move-file
]
keep
;